Last active
November 22, 2017 12:53
-
-
Save klaasman/3db53291dff89dc70ba3 to your computer and use it in GitHub Desktop.
Google analytics localStorage
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
var analyticsId = ''; | |
if (window.localStorage && window.localStorage.setItem) { | |
window.ga('create', analyticsId, { | |
'storage': 'none', | |
'clientId': window.localStorage.getItem('clientId') | |
}); | |
window.ga(function(tracker) { | |
return window.localStorage.setItem('clientId', tracker.get('clientId')); | |
}); | |
} else { | |
window.ga('create', analyticsId); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment