I’m trying to create a custom event in Google Analytics 4 based on an existing event’s parameter (form_id). My objective is to group multiple forms into a single event.
When I set the filtering condition in GA4 to “contains” and specify a single numerical ID (e.g. 1562), the event is sent correctly. However, issues arise when I switch to a regular expression for the form_id (e.g., “matches regexp” and then 1562|2106). In this case, while the GTM tag does fire, the event is not sent to GA4. I do test same form with ID=1562 in both scenarios.
The console shows an error: “Event processing aborted during augmentation.”
I’ve ruled out other factors and confirmed that the issue is with this RegExp condition. According to the documentation, using a regular expression in this manner should be valid.
Any insights on what could be causing this issue would be greatly appreciated.
Try to create your custom-event from GTM. What I mean is that you need to create a Tag and set the related parameters.
Then, create a User-Defined Variable for the form-id and define how the value is set to it (for example if you send the value by JavaScript or it is a dataLayer value).
In my case in the following photo you see JS_storeIdVariable as the user_defined variable which I have chosen to get its value from a custom-defined JavaScript
(JS) function. Remember, in this case, I am sending in front-end the value to the variable named storeId so that this function can read that value, something like
<script>
window.storeId = <?php echo $my_store_id ;?>;
</script>
Then, as the trigger for the Tag
you have created you should create a Trigger
which the filter you want is applicable here.
Do something like the photo below BUT you need to set the values based on what you need:
Also pay attention to the trigger type and select something which is meaningful to your case.
Please provide enough code so others can better understand or reproduce the problem.
Bot