Gtm server change ga4 loader

43 Views Asked by At

I have set up the gtm server and won't serve ga4 with a custom loader.

enter image description here

In the image above you can see that I send the request to the server gtm.

The string is like: https://www.t.ninso.at/gtag/js?id=G-VHW34YRYR5&l=dataLayer&cx=c

How I can configure gtm client to ask on different path for the script like: https://www.t.ninso.at/**newpath**/js?id=G-VHW34YRYR5&l=dataLayer&cx=c

I tried to change the server_container_url with another path but /gtag/ path is always included.

2

There are 2 best solutions below

0
Lucas On

The path of the query comes from the GTM library and there is no way to change it. The only way would be to change the GTM JavaScript library code.

Many ad blockers recognize this path and block the request even if you load the GTM library from your own server.

0
John On

There is a custom loader that can be configured in Tag Manager that will allow you to set your own path. This custom loader allow you to create any path you like, such as:

t.example.com/my_special_tracker.js

The full step by step instructions are here (not my website): https://www.simoahava.com/analytics/custom-gtm-loader-server-side-tagging/

But here's the summary:

  1. Install a code snippet to your Templates Gallery in Tag Manager
  2. Create a new client from the template
  3. While configuring the client, set your path, such as /gtm.js or my_special_tracker.js