In this guide, I’ll show you how to add first-party cookie values client-side, which your server-side Google Tag Manager processes can then access.
You might be wondering: “Why bother?”. After all, if server-side GTM is running same-site with the website sending the requests, why can’t it just read the cookies on its own, right?
Well, true. But there are cases where the website and web server seem to be same-site but are in fact not.
There are two new custom templates available in server-side Google Tag Manager. These templates have been designed to facilitate Piwik PRO tracking in a server-side container.
Piwik PRO Client -> This Client template interacts with the Piwik PRO JavaScript tracker and lets you route Piwik PRO tracking through a server-side GTM container. GitHub repo. Piwik PRO -> The tag template works in unison with the Piwik PRO Client, forwarding the hits to the Piwik PRO endpoint.
Piwik PRO has two new server-side Google Tag Manager templates, and this article explains what they are and how they work.
The first template, Piwik PRO Client, is designed to work in unison with the Piwik PRO HTTP API. Most often these requests are generated by the Piwik PRO JavaScript tracker, but theoretically any HTTP source that uses the same schema can send requests for the Client to claim. Once the Client claims the request, it generates an event data object that can be consumed by tags in the server-side Google Tag Manager container.
Google has released a new feature, First-Party Mode (FPM), into public beta.
Image source
First-Party Mode seeks to make it easier to wrap Google’s measurement and advertising technologies in a first-party, same-origin context.
This means that the user’s browser, when visiting a website running FPM, would no longer communicate directly with Google’s domains when fetching measurement libraries such as Google Tag or Google Tag Manager.
Instead, the requests would be sent to a subfolder of the website itself.
I have been a strong supporter of server-side tagging, in particular Google’s server-side tag management solution.
I admire the way it seeks to readjust the balance of control that typically has been in favor of the marketing vendors whose JavaScript libraries have been free to wreak havoc in the user’s browser.
By inserting a buffer between the user and the vendor, the owner of the server-side tagging setup can take control over what data the marketing vendors can actually process of the user.