Search code examples
javascriptgoogle-analyticsgoogle-tag-manager

Issue with Adblockers on server-side GTM


I am using Server side GTM, but I am facing adblocking issues when calling the below request when I want to retrieve the gtm?js file:

https://example.gtmdomain.com/gtm.js?id=GTM-MY_GTM_ID

The request works fine when I don't use adblockers.

Is there a way to rename the endpoint to something else, such as https://example.gtmdomain.com/secret_file_name.js?id=GTM-MY_GTM_ID in order to not be blocked by adblockers?


Solution

  • So, I finally implemented a great solution using GTM client templates. It works like a charm.

    To summarize, the steps are:

    1. Create a client template from your server container. You can import this template from https://raw.githubusercontent.com/gtm-templates-simo-ahava/gtm-loader/main/template.tpl
    2. Create a new client from this client template
    3. name your path as you want

    This article explains perfectly the required steps: https://www.simoahava.com/analytics/custom-gtm-loader-server-side-tagging/