Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Google universal tracking #135

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ JB :
# Set 'provider' to false to turn analytics off globally.
#
analytics :
provider : google
google :
provider : google_classic
google_classic :
tracking_id : 'UA-123-12'
google_universal :
tracking_id : 'UA-123-12'
domain: 'github.com'
getclicky :
site_id :
mixpanel :
Expand Down
6 changes: 4 additions & 2 deletions _includes/JB/analytics
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% if site.safe and site.JB.analytics.provider and page.JB.analytics != false %}

{% case site.JB.analytics.provider %}
{% when "google" %}
{% include JB/analytics-providers/google %}
{% when "google_classic" %}
{% include JB/analytics-providers/google-classic %}
{% when "google_universal" %}
{% include JB/analytics-providers/google-universal %}
{% when "getclicky" %}
{% include JB/analytics-providers/getclicky %}
{% when "mixpanel" %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ site.JB.analytics.google.tracking_id }}']);
_gaq.push(['_setAccount', '{{ site.JB.analytics.google_classic.tracking_id }}']);
_gaq.push(['_trackPageview']);

(function() {
Expand Down
10 changes: 10 additions & 0 deletions _includes/JB/analytics-providers/google-universal
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
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.JB.analytics.google_universal.tracking_id }}', '{{ site.JB.analytics.google_universal.domain }}');
ga('send', 'pageview');

</script>