GA4 Tag behaviour

Gold Contributor
Gold Contributor

Hi,
We have an issue with GA4 tag.
We have a single page application, where theGA4 tag runs a first time triggered by a first utag.view, then it runs again because another utag.view is sent to track virtual pageviews. We set a custom parameter customp at the config: config.customp.

First run result: In the console we see the config command and the pageview running the first time, and the page_view event is sent to GA4 with the correct customp value
Visualizzazione di image.png
Visualizzazione di image.png

Second run (virtual pageview), with an updated value for customp:
In the console we see the config command with the correct (new) value for customp:
Visualizzazione di image.png

But the page_view event is sent to GA4 with the previous customp value.

Visualizzazione di image.png
How is it possible? 
Can someone help me?

Regards,
Diego

5 REPLIES 5

GA4 Tag behaviour

Bronze Contributor
Bronze Contributor

Hi @die_rnd 

First of all, are you using automatic o manual page_view?

I do not know why, some weeks ago the mapping config.customp started to crash.

Previously, we had got all event parameters mapped to config.customp, both for automatic and custom events, and we started to suffer the same issue you're relating.

We partly fixed that issue, mapping all event parameters both to config.customp and to event.customp. The custom events will receive all the events parameter in the SPAs and the automatics events will receive the parameters once per URL.

So, if you have a manual page_view event, you will receive the parameters this way. 

Hope this could help you with that issue.

Knd Regards,

David

David HJ

GA4 Tag behaviour

Gold Contributor
Gold Contributor

I do not know why, some weeks ago the mapping config.customp started to crash.

Previously, we had got all event parameters mapped to config.customp, both for automatic and custom events, and we started to suffer the same issue you're relating.


Hi @David_H_J_LDA,
thank you for the answer!

Could you tell me what the behaviour was before the crash.
For the automatic events, were the parameters from the latest config?

Regards,
Diego

GA4 Tag behaviour

Bronze Contributor
Bronze Contributor

Hi @die_rnd 

Before the issue we were experiencing, we had mapped the event parameters with config.customparameter, and they were being sent to GA correctly for both automatic events (such as user_engagement) and custom events.

After the issue occurred, there were no custom parameters present in the automatic events or custom events. Mapping the custom parameters to event.customparameter resolved the issue for custom events, but only partially for automatic events.

Currently, the best option for params in custom events is to map them to event.xxxx. Automatic events should still be mapped with config.xxxx, but this will only work once per URL, so it won't be useful in a SPA. If you have a page_view as an automatic event, you should transform it to a custom event to have it sent on all pages with the parameters.

Kind regards
David HJ

GA4 Tag behaviour

Gold Contributor
Gold Contributor

Thank you David!
So, the issue is not solved for both! :)

GA4 Tag behaviour

Bronze Contributor
Bronze Contributor

But I do have got all event parameters in every page_view event on my SPA.

Have you tried the solution posted before?

If that doesn't fix the issue, may be something related with data layer and maybe this could help:

window.sendEvent = function(category, action, label){
utag.link({'eventCategory':category, 'eventAction':action, 'eventLabel':label,})}

Good luck!!!

David HJ
Public