securitygoogle-analyticsgoogle-tag-managerprivacypii

How can you scrub PII from a URL when using GA via GTM?


It's supposed to be done, and in plain Google Universal Analytics, it should be a simple matter of setting the location:

ga('set', 'location', sanitisedLocation);

But in GTM, of course, there is no place in the code snippet where the ga variable has been created, but the pageview has not been triggered.

So where would I add such code? I'm guessing it might be via the dataLayer but wouldn't know how, exactly.


Edit: I'd be happy to do this by editing the Pageview tag in the GTM UI, but I don't know where to override the location with a custom variable.


Solution

  • You have 2 options:

    enter image description here