June 14, 2021
Duplicate Events in Google Analytics 4 and How to Fix them
Lately, I have noticed an increasing number of people complaining about duplicate events in their Google Analytics 4 debug view. Sometimes the reasons for this are quite obvious, but sometimes they were a bit trickier than I initially anticipated.
If you are seeing something similar in your GA4 DebugView, you have come to the right place.
I have collected several most common issues I have dealt with when it comes to duplicate events in Google Analytics 4 and hopefully, you will find this article useful.
If none of the tips here helped you, let me know in the comments. Maybe we will find something new and then I will update the blog post.
#1. Hardcoded Google Analytics 4 and same events in Google Tag Manager
If you want to have GA4 installed on your website, a recommended way is to use Google Tag Manager. It gives you more flexibility and control.
However, sometimes marketers/analysts do that without realizing that some hardcoded GA4 tracking code is also sending the same events to GA4. The result? If, say, a visitor starts a checkout, two identical events will be sent to Google Analytics 4, one from GTM and one from GA4.
There are various ways to identify if you have hardcoded (added directly to the web site’s source code) GA4. If you are technical enough, you can check the source code of the website.
You can open your browser’s developer tools (I am using Chrome), then go to Sources.
Then hit CTRL + SHIFT + F (on Mac, that would probably be Command + SHIFT +F) and enter the name of the event that is tracked as a duplicate. In my example, that is add_to_cart.
When you enter it, check the search results and see if any of those codes contain “gtag”. If yes, it means that the add_to_cart event is also being sent from the website’s code.
If you found such a code, you are dealing with a thing called double tagging. It means that you are tracking same things with GTM+GA4 and with hardcoded GA4.
Another (more drastic) option could be to temporarily remove the GTM container from the website and see if you are still getting GA events (non-duplicate). If yes, then you have hardcoded GA somewhere on your website.
What is the solution? Audit your entire setup, remove unnecessary hardcoded GA4 snippets and at the same time, make sure that everything is configured only in Google Tag Manager. This is quite a complex process and if you want to learn more, enroll in my GTM course for beginners. Migration to GTM is one of the topics that I explain in great detail.
#2. Duplicate dataLayer events
Let’s say that you are seeing duplicate add_to_cart events in your GA4 Debug View. Those events are sent when a visitor clicks the “Add To Cart” button, a dataLayer.push is activated and the click information is visible in the preview mode.
Sometimes, the problem might be in the implementation, and because of some bug, a developer’s code activates the same dataLayer.push code multiple times.
If that is your case, then ask a developer to fix this problem and fire the same event only once per interaction.
#3. “Create event” feature in Google Analytics 4
This reason is possible if you haven’t properly invested enough time to learn Google Analytics 4 and just decided to guess what some features do.
If you log in to GA4 and go to Events, you will see a button called “Create events”. Sometimes, this might look confusing. Occasionally, people start sending events from GTM to GA4 (e.g. add_to_cart) but they also create the same event in the GA4 interface (with help of “Create events” feature).
That is NOT how this feature works. If you want to properly learn what “Create events” is and how to use it, read this guide.
All you need to know right now is that if you are already sending some events from GTM to GA4 and everything is fine with those events, you should NOT also enter them in the Create Events section.
Otherwise, you will be sending one event from GTM, and then GA4 will create another event with the same name and the same parameters if you create a rule like this:
This rule is looking for all events with the name “add_to_cart” (see Matching Conditions) and then it will copy all parameters of the event, hence create a new one (see Parameter configuration). The name of that new event will also be add_to_cart (see Custom Event Name field).
#4. The same container is added multiple times to the website
Also, it is possible that a developer accidentally added the same Google Tag Manager container twice. This will result in duplicate events. I have published a blog post explaining how to diagnose this.
Important: GTM’s preview and debug mode will cause multiple GTM containers to be shown on a website. Do your diagnosis while having the preview mode closed.
#5. Poor configuration of tag’s triggers
This part will be the least specific because there are a million ways how to misconfigure something. But maybe this will give you at least some clues.
When you start debugging GTM (by enabling the Preview and Debug mode), clear the stream:
Then complete the action that is causing duplicate events. Click on Summary in the GTM preview mode.
Then take a look at the tag that is supposedly causing duplicate events. How many times did it fire? If one, then the problem is somewhere else.
The tag fired twice or more? Click that tag. Then scroll down a bit and see the exact preview mode messages on which the tag fired. Did you expect the tag for fire on both events?
Click on the message that you did not expect. Then scroll down to see the triggering conditions that were met and fired the tag. Fix your trigger conditions to be more precise and not fire on this event. How you can do that? There is no quick fix. You will have to learn GTM, how it works and how to use it. My courses can help you with that.
Still seeing duplicate events in Google Analytics 4?
I would like to expand this guide and include more tips. So if none of my suggestions in this article worked for you, let me know in the comments. Maybe you have some other issue that will eventually become an additional tip in this blog post.
From my experience, the most common issues for duplicate events in Google Analytics 4 are hardcoded events vs GTM and misconfigured GTM triggers.