Google Analytics GA4 can be configured with a Google Tag manager server. When you set up GTM server tagging, you will see GA4 client is already available by default. In this post, we will discuss the benefits and possibilities that GTM server-side tagging offers with details of how you can configure the GA4 tracking Tag in the container.
Table of Contents
- Benefits of implementing GA4 server-side tracking
- Setting up Google Analytics GA4 in Google Tag Manager Server-side Container
Benefits of implementing GA4 server-side tracking
Hosting on your subdomain gives you the massive benefit of bypassing AdBlocker and Intelligent tracking preventions. A custom subdomain feature is not available in a free plan, for that you will have to update to paid plans.
AdBlock, a popular blocking extension, is reported to have more than 65 million users. Ad blocking is most common among internet users between 16 and 24 years old. Among this demographic, 46.2% of users worldwide admit to using ad blockers. Its means that a bit more than a quarter of paid ads will never reach their audiences. And this number is expected to grow by 2-3% annually.
Earlier it was adblockers that prevented the tracking of website data of visitors. But some browsers are using Intelligent tracking prevention technology, which is specifically designed to block 3rd party cookies in the browser. Firefox launched in 2019, and after that safari started using ITP in 2020.
By utilizing server-side tagging you can create tagging URL within a custom subdomain that is located in the same hierarchy as your website domain, eg. gtm-server-mydomain.com. In this case, collect requests will be sent not to google-analytics.com, but to your gtm-server-mydomain.com. This way, you will make GA request to the first party, and it would be blocked by ITPs and AdBlockers.
https://gtm-sever-mydomain.com/g/collect?v=2&tid=G-S1HVJL90DJ>m=2oe760&_p=555226752&_z=ccd.v9B&cid=311106949.1653632373&ul=en-us&sr=1920x1080&_fplc=0&_s=1&sid=1657531072&sct=57&seg=1&dl=https://shoptaylor.in/&dt=Home - shoptaylor.in&en=page_view&_c=1&richsstsse
Increase cookie lifetime.
Safari and Firefox are limiting the cookie lifetime to 7 days only, or in some cases to 24 hours only. It means that unless a user is revisiting your site every day and cookies are continuously updated, it will expire within a day/week. In that case, google analytics will consider all these visitors as new. You can check the latest updates on the browser.
Recently there is only one way to avoid this to run Google Analytics via Server-Side Google Tag manager. This feature is enabled by default, but we recommend checking it to 100% sure that cookie lifetime is set up to a more than an extended period.
Setting up Google Analytics GA4 in Google Tag Manager Server-side Container
- Create a Google Tag Manager Server-Side container if you haven’t created one.
- Make sure you’ve changed the tagging URL inside your Google Analytics variable within Google Tag Manager Web Container. Inside Google Tag Manager Web Container, go to Variables -> Choose your Google Analytics variable -> More Settings -> Advanced Configuration -> Past Transport URL.
3. Setup GA4 tag inside GTM server container. Open “Tags” section inside Server-Side GTM Constiner and click “New”.
Name Your Tag, choose tag type “Universal Analytics.”
Create a trigger. Trigger type “Custom,” choose “Some Events.” Client Name equals Universal Analytics.
You might not see the Client Name variable in the dropdown. In this case, open the Variables tab, click Configure, and enable all variables.
4. Open the preview mode if Google Tag manager severs container to verify it sends events to Google Analytics. You can see your standard events and custom events that you send via web GTM.
Now Your Google Analytics GA4 runs via a server container. If you have any questions or concerns please share them in the community box.