Hey Natwar, you can use analytics.ready to fire off native GTM code on the page after Segment loads the GTM container you put in your GTM integration settings inside of Segment. I'm not a GTM expert but I'm guessing it works similar to loading multiple instances of GA on a page, Segment has some docs about that here: https://segment.com/docs/integrations/google-analytics/#multiple-trackersReply
Because this topic comes up often, I wanted to provide a bit more detail about how exactly to implement this, if needed.
As Jake referenced in our documentation, customers will need to use analytics.ready to initialize the native GTM container (which will then initialize GA). We recommend doing this in the initialization script between analytics.load and analytics.page so that the page event is picked up by GTM.
It would look like this:
You should also ensure that the native GTM code is added separately within the <body> tag as Google indicates in their docs. You do not need analytics.ready to run the code in the body.
That's it. This will allow Segment's Google Analytics destination to initialize in device mode on the browser and will also safely initialize GTM & GA onto the browser for multiple tracking.Reply