I configured purchase and add_to_card the same way as ga4 event tags inside the webcontainer. They both fire like expected, but only add_to_card is being received by the server container. I did use the same GA4 ID for both events and the GA4 Tag has the serverside url filled out. When taking a look in the devtools, add_to_card requests tr.domain.tld, while purchase only requests region1.google-analytics.com which is why it makes sense to me, that it’s not being shown in debugmode on the servercontainer.
Any help for this?
Your purchase likely fires prior to Config, which is why it doesn’t pick on the server_container_url from the Config (Googe Tag). You want to make sure all your events fire after base tag, and not before.
Hey Dan,
thank you for your fast reply. How can I make sure it is being fired afterwards? The Tag Manager is loaded by the borlabs cookie plugin, not by the stape wordpress plugin and the Base G-Tag is being triggered by borlabs-cookie-opt-in-google-analytics event.
Kind regards,
Fabian
You can use a trigger group where there will be both triggers - consent and add to cart. This way the trigger group will always be triggered after both events are in the data layer.
thank you for your reply. By now I am using a custom event (eventname: purchase) as trigger which has a condition checking for analytics consent, shouldn’t this behave the same way as a trigger group?
May this happen because I load Tag Manager by myself and not via the stape wordpress plugin? So maybe Tag Manager gets loaded too late and the stape plugin doesn’t wait for it to be fully initialized and fires the purchase event before gtag is fully intitialized?
No, it’s definitely not related to how you load GTM, it’s just a bug in the tag and trigger setup.
The best practice is to use a trigger group which consists of two triggers: one is the event where the current state of the consent is known and the other is the event trigger itself.
Purchase Event is 83 which fires before borlabs-cookie-opt-in-google-analytics (86). Now I got the trigger group which is waiting for borlabs-cookie-opt-in-google-analytics resulting in firing at 96. But the event borlabs-cookie-opt-in-google-analytics only means gtag started to load not that it was fully loaded and initialized, right? So is there a chance that even the trigger group fails sometimes to send to purchase server request, as gtag just isn’t fully loaded yet? Hopefully it’s understandable, what I mean.
No, that’s not a problem. Your google tag runs on a consent event (in your case borlabs-cookie-opt-in-google-analytics), and the purchase event triggers on the trigger group. The only important thing is to make sure that the purhcase tag does not trigger before the Google tag and in that case everything will work correctly.