Skip to content

Commit e976805

Browse files
Merge pull request #6843 from segmentio/prigiattiperrut-patch-5
Adding a new topic about duplicate events
2 parents f25ccb1 + 08c202a commit e976805

File tree

1 file changed

+12
-0
lines changed
  • src/connections/destinations/catalog/google-tag-manager

1 file changed

+12
-0
lines changed

src/connections/destinations/catalog/google-tag-manager/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,23 @@ If you are seeing `404` error on the JavaScript console of your page and it is a
8484

8585

8686
### Duplicate Events
87+
8788
If you have Google Ads enabled and see duplicate events in GTM, check to see if the event is set as a conversion in Google Ads. Duplicate conversions are common when you use both Google Ads and GTM, since Segment's Adwords destination initializes the gtag script with the dataLayer itself. So, when you fire a mapped event, Segment submits the payload directly to the dataLayer.
8889

8990
Google recommends using [transactionIds](https://support.google.com/google-ads/answer/6386790){:target="_blank"} to prevent this duplication.
9091

9192

93+
On the dataLayer, you might find the `eventModel` field, which is an internal Google field only present in events captured by the Google Ads SDK. To prevent GTM tags from creating duplicate events, you can create a GTM variable and use `eventModel` as a condition to filter events.
94+
95+
> warning "The following solution was shared by a Segment customer and is not officially endorsed by Segment"
96+
> Please test this solution before implementing it with production data. If you have any questions about the GTM setup, consult the [GTM documentation](https://support.google.com/tagmanager/answer/6103657?hl=en){:target="_blank"}.
97+
98+
1. Create a [GTM variable](https://support.google.com/tagmanager/answer/7683056?hl=en){:target="_blank"} to capture the `eventModel` field when events hit the Google DataLayer
99+
2. Set the variable to add the value "GTM" to the `eventModel` field when the field is not present in the event dataLayer. The format value should be set to "Convert undefined to GTM"
100+
3. Add the newly created variable to your GTM trigger so that only events containing `eventModel = GTM` trigger the tag.
101+
102+
103+
92104
## Appendices
93105

94106
### UserId and AnonymousId

0 commit comments

Comments
 (0)