Last active
March 21, 2016 11:46
-
-
Save OrenBochman/913f4d0610acc2ae11a2 to your computer and use it in GitHub Desktop.
customising the analytics snippet to clean PII : remove userID from page path.js for standard page reporting
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
// Checks to see if the current user's userID is found in the URL, if it is, remove it. | |
var userID = ""; // (Note, this assume the user ID is stored in a variable called `userID`) | |
if (document.location.pathname.indexOf('user/' + userID) > -1) { | |
var page = document.location.pathname.replace('user/' + userID, 'user'); | |
ga('send', 'pageview', page); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment