From 858c19fe302e66b61d0c24f0e40650504ca3a9cb Mon Sep 17 00:00:00 2001 From: prigiattiperrut <47340158+prigiattiperrut@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:42:24 +0100 Subject: [PATCH 1/3] Update index.md --- .../destinations/catalog/google-tag-manager/index.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/connections/destinations/catalog/google-tag-manager/index.md b/src/connections/destinations/catalog/google-tag-manager/index.md index 743a6b8369..7253c6962a 100644 --- a/src/connections/destinations/catalog/google-tag-manager/index.md +++ b/src/connections/destinations/catalog/google-tag-manager/index.md @@ -84,10 +84,21 @@ If you are seeing `404` error on the JavaScript console of your page and it is a ### Duplicate Events + 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. Google recommends using [transactionIds](https://support.google.com/google-ads/answer/6386790){:target="_blank"} to prevent this duplication. +### Duplicate Events triggering GTM tags multiple times + +In reviewing the "dataLayer" tab for each event in GTM, it was observed that the `eventModel` field, which is an internal Google field, is only present in events captured by the Google Ads SDK. To prevent GTM tags from firing multiple times due to duplicate events, you can create a GTM variable and use `eventModel` as a condition to filter events. + +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 +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" +3. Add the newly created variable to your GTM trigger so that only events containing `eventModel = GTM will` trigger the tag. + +This solution has been shared by other customers. Please test it before implementing it with production data. If you have any questions regarding the GTM setup, consult the [GTM documentation](https://support.google.com/tagmanager/answer/6103657?hl=en){:target="_blank"}. + ## Appendices From ae410321d7622f05effbc61ba08a2bc3284b66af Mon Sep 17 00:00:00 2001 From: forstisabella <92472883+forstisabella@users.noreply.github.com> Date: Tue, 13 Aug 2024 12:47:38 -0400 Subject: [PATCH 2/3] Apply suggestions from code review --- .../destinations/catalog/google-tag-manager/index.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/connections/destinations/catalog/google-tag-manager/index.md b/src/connections/destinations/catalog/google-tag-manager/index.md index 7253c6962a..6fd47df59d 100644 --- a/src/connections/destinations/catalog/google-tag-manager/index.md +++ b/src/connections/destinations/catalog/google-tag-manager/index.md @@ -89,15 +89,13 @@ If you have Google Ads enabled and see duplicate events in GTM, check to see if Google recommends using [transactionIds](https://support.google.com/google-ads/answer/6386790){:target="_blank"} to prevent this duplication. -### Duplicate Events triggering GTM tags multiple times In reviewing the "dataLayer" tab for each event in GTM, it was observed that the `eventModel` field, which is an internal Google field, is only present in events captured by the Google Ads SDK. To prevent GTM tags from firing multiple times due to duplicate events, you can create a GTM variable and use `eventModel` as a condition to filter events. 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 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" -3. Add the newly created variable to your GTM trigger so that only events containing `eventModel = GTM will` trigger the tag. +3. Add the newly created variable to your GTM trigger so that only events containing `eventModel = GTM` trigger the tag. -This solution has been shared by other customers. Please test it before implementing it with production data. If you have any questions regarding the GTM setup, consult the [GTM documentation](https://support.google.com/tagmanager/answer/6103657?hl=en){:target="_blank"}. ## Appendices From 08c202a1582e099462c8c17150b0606c024428b1 Mon Sep 17 00:00:00 2001 From: forstisabella <92472883+forstisabella@users.noreply.github.com> Date: Wed, 14 Aug 2024 11:28:54 -0400 Subject: [PATCH 3/3] Update src/connections/destinations/catalog/google-tag-manager/index.md --- .../destinations/catalog/google-tag-manager/index.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/connections/destinations/catalog/google-tag-manager/index.md b/src/connections/destinations/catalog/google-tag-manager/index.md index 6fd47df59d..d7c778459e 100644 --- a/src/connections/destinations/catalog/google-tag-manager/index.md +++ b/src/connections/destinations/catalog/google-tag-manager/index.md @@ -90,7 +90,10 @@ If you have Google Ads enabled and see duplicate events in GTM, check to see if Google recommends using [transactionIds](https://support.google.com/google-ads/answer/6386790){:target="_blank"} to prevent this duplication. -In reviewing the "dataLayer" tab for each event in GTM, it was observed that the `eventModel` field, which is an internal Google field, is only present in events captured by the Google Ads SDK. To prevent GTM tags from firing multiple times due to duplicate events, you can create a GTM variable and use `eventModel` as a condition to filter events. +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. + +> warning "The following solution was shared by a Segment customer and is not officially endorsed by Segment" +> 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"}. 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 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"