Search code examples
google-analyticsgoogle-tag-managergoogle-analytics-4

GA4: Filter Events Based On User ID


I am using GTM to track users and traffic on my website with GA4. My goal is to exclude traffic from internal users but all the information I find about that topic is around filtering based on IP addresses. As everyone is distributed geographically working from home, I wanted to set it up to filter by the user ID which is already being tracked.

I read about having to set debug_mode or debug_event to true and enabling the debug traffic filter in GA4. For the debug_mode variable, I set up a lookup table like this:

enter image description here enter image description here

As I said, I am already tracking the user ID, so I know the {{ User ID }} part to work. Finally, I made this configuration to send debug_mode to GA4:

enter image description here

The problem is: When I open the website I am seeing the events in GA4's Debug View without going through "Preview" of GTM, BUT I am also seeing it in the realtime dashboard.

Any ideas?


Solution

  • If you set up debug_mode is true. This would only allow you to see more detail data in the debug_view. It will also show in the Realtime Report

    This is not the way you want to exclude certain users.


    Now we can only create a trigger and except it on every GA4 trigger you used. This might take some time but we can only wait for Google to release a better and faster way to manage it.

    enter image description here