With GDPR looming around the corner, it’s time to explore the options you have at your disposal for respecting the new, stricter regulations for tracking users and for collecting data about their visits to your website.
UPDATE 20 June 2018: Google has released the allowAdFeatures field which renders the solution below redundant (at least for the displayFeaturesTask part of it). Please refer to this article for more details on how to conditionally block the advertising hit to DoubleClick.
Sending personally identifiable information (PII) to Google Analytics is one of the things you should really avoid doing. For one, it’s against the terms of service of the platform, but also you will most likely be in violation of national, federal, or EU legislation drafted to protect the privacy of individuals online.
In this #GTMTips post, I’ll show you a way to make sure that any tags you configure this solution with will not contain strings that might be construed as PII.
If you open the Google Tag Manager user interface and browser your tags, triggers, and variables, you might notice that the UI now has two new features:
Pagination, where only 50 results are shown per page
A quick search / filter bar at the top of each list, which lets you narrow the list down to results that match your query
Pagination might be a nuisance in large containers, but it was implemented to improve performance.
Facebook’s pixel has an attribute named content_ids (required for Dynamic Ads), which requires an Array of content IDs as its value. It’s very possible you’re running this pixel on a site which already has Enhanced Ecommerce for Universal Analytics implemented, and now you want to use the same Enhanced Ecommerce data that your developers have already made available in this Facebook pixel.
Or perhaps you want to concatenate a list of strings, such as article tags (['culture', 'politics']), and send it as a comma-separated string to Google Analytics ('culture,politics').
Here we are again, revisiting an old theme. When using Google Tag Manager, we often want to send the contents of the same tag to multiple Universal Analytics properties. With on-page GA, this used to be quite simple, as all you had to do was create a new tracker and then just remember to run the ga('trackerName.send'...) commands to all the trackers (or you could use my duplicator plugin). With GTM, your options are more limited, since Google Tag Manager abstracts the tracker object, giving you far fewer tools to work with.
One of the things I’ve recommended from the get-go is to always send the Client ID to Google Analytics with your users’ hits. This is very useful for adding a level of granularity to your tracking. At first, I recommended using an Event tag to do this. Then I modified my approach a little so that you could send it with your initial Page View (thus not inflating your hit counts).
This is, by no means, a novel topic in this blog. I’ve covered Google Tag Manager’s event tracking and triggers numerous times before (see below).
Auto-Event Tracking In GTM 2.0
#GTMtips: Track Outbound Links In GTM V2
#GTMtips: Fix Problems With GTM Listeners
Trigger Guide For Google Tag Manager
However, based on the number of queries we still see in the Google Tag Manager Product Forums about event tracking, I believe one particular aspect of GTM’s triggers invites revisiting.