Created
February 20, 2018 17:55
-
-
Save ivolivares/1b773b37645859d1b5c11a12a9e0b7de to your computer and use it in GitHub Desktop.
Get client ID (Universal Analytics)
This file contains hidden or 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 cidFunction() { | |
| var trackers = ga.getAll(); | |
| var i, len, trackerCid; | |
| for (i = 0, len = trackers.length; i < len; i += 1) { | |
| if (trackers[i].get('trackingId') === 'UA-XXXXXXXX-X') { | |
| trackerCid = trackers[i].get('clientId'); | |
| } | |
| } | |
| console.log(trackerCid); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment