We already discussed why you would want to use your Own CDN for server side tracking.
The part that a lot of people omit, is that in such a setup your server GTM will receive a request from an IP of your CDN provider, not the actual IP of the user, which may have an effect on your reporting. Here’s an example:
My IP is: 126.96.36.199 but since the subdomain pointed to my sGTM is proxied through Cloudflare, I get a completely different address in the Common Event Data:
This means incorrect geo data in your destinations (GA4 would be the most obvious one), and of course also throws a wrench into whatever tags/functionality you may have directly reliant on IP address.
Let's look at the Cloudflare example, the most commonly used CDN. The original IP address will always be available in Cf-Connecting-Ip header:
We can access this data with a native Request Header variable, very straightforward:
Now that we have a proper IP available to us in a variable, we need to apply to our tags. The simplest way to apply to all your sGTM tags is to use Transformations:
1. Go to Transformations section of your sGTM.
2. Create a new one, pick ‘Augment Event’:
3. We want to augment event data, so that ip_override (a common event data parameter used by all the tags) is replaced with the value of our header, which we’ve previously created a variable for:
4. Hit ‘Save’ - now all your sGTM tags will reference a proper user IP:
Learn how to use Google Analytics in a GDPR-compliant way with our new 100% European server GTM hosting.Apr 13, 2023
Learn how you can use Stape's Cookie Keeper to increase first-party cookie lifetime set by third-party IPs in Safari 16.4 and other browsers using ITP.