Skip to content

Commit

Permalink
add google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
shunk031 committed May 6, 2018
1 parent 6a4b3bf commit 708fc10
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions _config.yml
@@ -1,6 +1,7 @@
# Site settings
title: "Shunsuke KITADA | Resume"
description: "This is my resume page"
google_analytics: UA-114287158-2

# Build settings
markdown: kramdown
Expand Down
9 changes: 9 additions & 0 deletions _includes/analytics.html
@@ -0,0 +1,9 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-114287158-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '{{ site:google_analytics }}');
</script>
3 changes: 3 additions & 0 deletions _includes/head.html
Expand Up @@ -15,4 +15,7 @@
<link rel="stylesheet" href="css/main.css">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="icon" type="image/x-icon" href="/favicon.png" />
{% if site.google_analytics and jekyll.environment == 'production' %}
{% include analytics.html %}
{% endif %}
</head>
3 changes: 1 addition & 2 deletions deploy/deploy.sh
Expand Up @@ -11,8 +11,7 @@ TARGET_BRANCH="gh-pages"

function doCompile {

bundle exec jekyll build

JEKYLL_ENV=production bundle exec jekyll build
}

# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
Expand Down

0 comments on commit 708fc10

Please sign in to comment.