GTM js going to 400 bad request

Discussion about server side tracking for Magento (server GTM container, GA and FB CAPI)

I created container and configure stape and GTM but when try to load my page it seems gtm.js is going to 400 bad request and not doing any tracking

Are you certain you’re not trying to embed the server container iso the web one? Is there URL where we can see that error?

hi, can you at least expand the error text from your screenshot? Really hard to debug like this.

What is your WEB (client-side) container id?

Hi Dan,
Thanks for you replay. Here is container id :: GTM-57WZHXWF

The problem seems to be that you are using incorrect GTM loader.
Please provide screenshot of your GTM snippet which is inserted in head of all pages

Hey Alex here is snippent from my head

The problem is that your snippet is not correct.
Copy and use the snippet from your web GTM container if you want to use the standard one, or use the power-up ‘Custom loader’ on Stape and copy the snippet from there - this will allow you to have protection from adblockers.

It didn’t helped instead now it stop loading gtm js on site when I added locader code to magetnto configuration.

Can you please show which loader you are using now?

You show a screenshot of the Stape interface, and to understand what is not working on your site - you need to understand what GTM snippet is installed on your site (you can find it for example through the browser console in the page elements) and also in the network console tag to see where the request goes to load your GTM container.

and on site page it show like this

Are you using the Stape app for Magento? If yes, can you show a screenshot of its configuration?

For this to work correctly you need to specify custom domain and custom loader which you can take in Custom loader power-up

But in extension just mention that you only need gtm tag id and add stape container config to GTM container and its all set.

I have been struggling with this for the last 1 week and I haven’t been able to find the exact solution.

There should be clear cut instruction to integrate with magento isn’ it?

It’s described here: Server-side GTM extension for Magento 2 - Stape

And also when you use Custom loader in the interface:

It isn’t possible without a custom domain?