Created
October 27, 2016 15:29
-
-
Save ben1one/b5121a2241824f693b167306e30b7478 to your computer and use it in GitHub Desktop.
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
function pageTracking() { | |
var url = $_data.URL; | |
if (!url.startsWith("/")) { | |
url = "/" + url; | |
} | |
//console.log(url); | |
if (isGaLoaded()) { | |
var ga_url = url; | |
//console.log(ga_url); | |
//Old tracking | |
if ('object' === typeof _gaq) { | |
_gaq.push(['_trackPageview', ga_url]); | |
console.log("Old tracking"); | |
} | |
//New tracking | |
if ('function' === typeof ga) { | |
ga('send', 'pageview', ga_url); | |
console.log("New tracking"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment