A new way to set up a custom domain in server GTM
MD HEDAYETUL ISLAM
Web Analytics Specialist | GA4, GTM, Facebook Conversion API & E-Commerce Tracking Expert
When setting up server-side tagging, the best practice was?configuring a custom domain for your server Google Tag Manager environment. This approach primarily allows setting up first-party cookies, which have a longer lifespan than third-party cookies, enhancing user tracking and data collection consistency.
With the new restrictions coming from Safari, more than just setting up a custom domain is required to prolong cookie lifetime. Even if you map a custom domain, cookies in Safari will be shortened. To make it last longer, you must ensure the custom domain has the same IP address as your website’s primary domain by configuring?Own CDN, or use stape?Cookie Keeper power-up to store and restore cookies.?
However, Google has recently changed the preferred way of mapping a custom domain for the server Google Tag Manager container. Instead of using a subdomain (like sgtm.example.com) they encourage using the same origin (like example.com/sgtm).?
With the same origin custom domain for sGTM, you will have the main benefit of server-side tagging - setting up first-party cookies. And with the tagging server using the same origin domain, you do not need to configure any additional settings to prolong cookies. However, mapping the same origin will be more complicated than configuring a subdomain.?