0

Feature Request: option to stop Segment from pushing event to GTM datalayer

I trigger Segment based off of GTM datalayer events. Until now I kept experiencing this infinite event submission bug and I had no idea where it was coming from.

Because I have a datalayer push with the same event name as the one that I submit a Segment track event with, GTM will push the event name and trigger Segment, then Segment will push the same event name to GTM and trigger itself over and over again.

In order for me keep things universal I want specific event names in GTM that will be used to trigger Segment, and use that same event name when submitting an analytics.track() event.

Can there be a toggle in the GTM integration where Segment does not submit an event to the data layer? GTM is more universal than Segment so it's better to keep Segment as a way to submit tracks and not data layer events.

6replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Tanner,

    To clarify are you loading Segment in GTM, or are you loading GTM via Segment? If you do not wish for an event to be sent to GTM, you can select what destinations you wish the event to be sent to in your event calls:

    analytics.track('Test', {
      action: 'test action'
    }, {
      integrations: {
        'Google Tag Manager': false
      }
    });

    > https://segment.com/docs/sources/website/analytics.js/#selecting-destinations

    Best,

    Xavier

    Reply Upvote
  • I'm loading GTM through Segment as is recommended by your team and the documentation. If I have GTM set to false for the track event, does the GTM library still get loaded on page load if Segment is loaded with GTM as a destination?

    If this is the appropriate solution, it would be awesome to also have this feature directly in the GUI. Having to add GTM false to every Segment event is cumbersome.

    Reply Upvote
  • Hi  Tanner Chung ,

    If you wish to prevent GTM from loading on a page, you can modify the analytics.js snippets load method:
     

    analytics.load('writekey', { integrations: { All: true, 'Google Tag Manager': false } })

    > https://segment.com/docs/sources/website/analytics.js/#load-options

    We do support selecting what destinations you wish each event to go to in the UI as well if you are on our business tier account:

    > https://segment.com/docs/protocols/schema/#destination-filters

    Best,

    Xavier

    Reply Upvote
  • Hey Xavier,

    I'm not asking about having Segment load GTM. I'm asking about disabling Segment from submitting DataLayer events from the Segment GUI.

    Reply Upvote
  • Hi Tanner,

    To clarify, we do support selecting what destinations you wish each event to go to in the UI as well if you are on our business tier account:

    https://segment.com/docs/protocols/schema/#destination-filters

    This will prevent specified events from being sent to the GTM dataLayer.

    Best,

    Xavier

    Reply Upvote
  • Xavier Agostini It'd be great if you could just turn it off in the GUI. To add the GTM exception to every event triggered is really cumbersome when the Segment team recommends loading GTM through Segment rather than Segment through GTM. This mean every event I trigger with Segment will show up as a dataLayer event in GTM - which in itself is supposed to be the trigger in the first place.

    Reply Upvote