-
-
Save Shoora/c572a102df823b459050 to your computer and use it in GitHub Desktop.
Enhanced Link Attribution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// optimized http://mathiasbynens.be/notes/async-analytics-snippet#universal-analytics | |
(function(G,o,O,g,l){G.GoogleAnalyticsObject=O;G[O]||(G[O]=function(){(G[O].q=G[O].q||[]).push(arguments)});G[O].l=+new Date;g=o.createElement('script'),l=o.scripts[0];g.src='//www.google-analytics.com/analytics.js';l.parentNode.insertBefore(g,l)}(this,document,'ga')); | |
ga('create','UA-XXXXXXXX', 'auto'); | |
// Enhanced Link Attribution: | |
// https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#enhancedlink | |
// https://support.google.com/analytics/answer/2558867?hl=en | |
ga('require', 'linkid', 'linkid.js'); | |
// Support Display Advertising: https://support.google.com/analytics/answer/2444872?hl=en&utm_id=ad | |
ga('require', 'displayfeatures'); | |
// Track special redirect url, if you set one | |
var url = $('#ga_track_r_url').val(); | |
if (url && url != '') ga('send', 'pageview', url); | |
// Send usual page view | |
ga('send','pageview'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment