Skip to content

Commit

Permalink
fix(analytics): Use custom dimension to send opt-out cookie value
Browse files Browse the repository at this point in the history
WIP: #2
  • Loading branch information
Derek Michael Frank committed Mar 10, 2017
1 parent b63aafe commit cc82eba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions _includes/analytics.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics }}', 'auto');
if (window.readCookie) {
ga('set', 'dimension1', readCookie('optout'));
}
ga('send', 'pageview');
</script>
{% endif %}
2 changes: 2 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
<title>{% if page.title %}{{ page.title }} | {% endif %}{{ site.title }}</title>

<script>{% include cookies.js %}</script>

{% include analytics.html %}
{% seo %}
</head>
Expand Down

0 comments on commit cc82eba

Please sign in to comment.