Filters have been one of the most requested features for Google Analytics 4 (GA4) properties. Google just started to roll out filter components and has other complementary features to improve your data quality. One of these new features is the new “Modify Events.” Modify events allows you to fix tagging issues by renaming or event deleting events and parameters directly within the GA4 interface.
If you prefer video guides, I made a YouTube companion.
How Do Modify Events Work in GA4?
At some point, all of us have experienced the pains of mistagged events, as shown in the image below. Here we can see someone made a mistake (it was me 😂). Instead of having one event for scroll tracking, we have three (scroll_tracking, scroll, and scroll tracking).
Previously, the only option to fix this in GA was to use filters or fix it by updating our tags. While the best solution is still to fix it at the source, there are still situations where we need other options. Maybe your Google Tag Manager developer is out on vacation, or perhaps your issues are within your mobile app streams and an update isn’t possible for a week or so. Obviously, we don’t want to continue to collect mistagged data, so this is where modify events can help save the day!
How to Use Modify Events
We will use the real example above, where I have accidentally created multiple scroll events. This will likely be common in GA4 properties related to introducing the new enhanced/automatic measurement. With automatic measurement, Google automatically added a scroll tracking event for anyone who reaches the 90% threshold on your pages.
Most users will likely want more thresholds than just 90%, so additionally, they will also set up custom scroll tracking. When setting up the custom scroll tracking, you want to be very careful to use the same event_name and event_parameters as the automatic measurement does. If you use anything other than scroll and percent_scrolled, you will have multiple events that are the same thing.
Here is how we fix our multiple versions of the same event:
- Start by going into your events report and click “modify event”
2. Click “create”
3. Now, we need to create the event modifications. Start by entering a modification name. Enter something meaningful here, so you can find it later if additional changes are needed.
Next, enter the matching conditions, which determines which event or parameters you want to modify. We want to match the default/automatic scroll tracking event (scroll), and we need to target the misnamed one (scroll tracking). We target the misnamed one by using the matching conditions and using event_name equals scroll tracking.
Now we enter the new name for our event. Here we use the modify parameters section and use the parameter of event_name and a new value of scroll. Click create and we’ve deployed our fix!
4. Optionally, you can also make changes to additional event parameters at the same time. The automatic scroll tracking uses a percent_scrolled parameter, which sends a value of 90 every time a user scrolls to 90% of your page. When I deployed my custom scroll tracking library, I sent values of 10, 25, 50, and 75 but accidentally named the parameter percentage_scrolled instead of percent_scrolled.
We can fix the parameters by going back into our modify event settings and adding additional modifications
The image shows how we renamed the event parameter. There is a lot to unpack on how we did it. To rename percentage_scrolled to percent_scrolled first, we need to create the percent_scrolled parameter and pass the dynamic value using double brackets [[ ]]. Then we delete percentage_scrolled by leaving the new value blank.
With the flexibility provided, there are multiple ways to achieve the same results, either as separate modifications or potentially within a single one, as shown above. You can create up to 50 event modifications, so combining changes where possible may be advantageous for the future. The support center includes other examples of how you can create even more advanced changes.
Real-Time Debugging
As you deploy/test your event modifications, you can see them in real-time if you enable the Google Analytics debugger or are in the preview mode of Google Tag Manager. When you are in the debugging modes, GA4 automatically collects the data in the DebugView report, which is a realtime stream of all the debugging data. You can easily see all the events in the order they are collected and their associated parameters/user properties/other data to see if your changes are working as expected. In this example, we can see all our events are now named scroll (instead of scroll and scroll_tracking)!
I’m really excited about this new feature for event modifications and the related “Create Event” feature. It is important to note that all changes only work moving forward, so it will not fix any of the data that has already been collected (though the new data deletion tool may allow you to delete it). These features now give marketers a way to quickly fix various issues related to event tagging and naming without having to release code updates, which are not always possible.