Last active
April 30, 2019 08:13
-
-
Save kosperera/409052996ceaeceff60c3da887af4856 to your computer and use it in GitHub Desktop.
Show Google Analytics Tracker data.
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 showmethemoney(asjson) { | |
var a = ga.getAll(); | |
a.forEach(function(g) { | |
var json = { | |
gid: g.get('_gid'), | |
trackingId: g.get('trackingId'), | |
clientId: g.get('clientId'), | |
cookieDomain: g.get('cookieDomain'), | |
location: g.get('location'), | |
data: JSON.parse(JSON.stringify(g.b.data.values)) | |
}; | |
console.log(asjson ? JSON.stringify(json) : json); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to run
showmethemoney()
To get the output as JSON string
showmethemoney(asjson = true)