Page load issue with GA4 - google-analytics

We have a problem related to execution times are observed related to GA4:
Basically, the page loads so fast that once an action is signalled and, in most cases, GA4 does not have time to execute. We did not see this problem with UA.
With 'Preview Mode'in GTM, GA4 executes as it should do, and so, the information is sent to GA4 servers.
About the "normal" execution: the website behaves way too fast, and so, even though GA4 executes, it does not have enough time to send the information to GA4 servers (pending requests which information does never reach GA4 servers).
We investigated and tested different implementation ways to fix it but the problem is still there.
Any of you have an idea about this?
We also attach the screenshots of the tests carried out:
UA run times, approx. 100-200 ms. - Image 1
GA4 runtimes, approx. 5 seconds - Image 2
GA4 execution times with the GA Debug extension activated, approx. 100-200 ms. - Image3
Many thanks,

Do you still see the issue between UA and GA4?
Based on the google document from GA4, GA4 will use sendBeacon to send events, this is to fix some problems with the old UA using XMLHttpRequest to send events, the problem with the XMLHttpRequest is that if events send during the unload page event, the events might not send by the browser.
Also, depending on the scenarios, most GA4 events will batch together and send from the browser, so if you're in debugging mode, events are sent immediately, that's why you see the time faster.
So, in normal mode, GA4 might send events in delay but it batch events altogher, the good thing is if you go to a different page, the event will continue to fire sine GA4 using the sendBeacon API.
You can also refer to this article from GA4 about event batching for GA4.

Related

How to speed up loading of Google Analytics 4 tracker?

I’ve been experiencing a discrepancy in terms of page views between GA4 and GA3, both installed through GTM page view event.
I notice that GA4 is much slower to send the collect request compared to GA3, literally takes 3-4 seconds more from my office connection and pc.
I think that this is the main cause of discrepancy between the two.
Is it possible to somehow speed up GA4 tracker?
I remembered Google design this feature.
Here is the reference from a blog post
One thing you might have noticed is the delay it takes for the hit to
be sent. When you load the page, you can see how the browser waits a
few seconds before dispatching the hit to GA. This is because GAv2
batches requests automatically, which, again, is a great feature
upgrade.
Link
GA4 now will send multiple event as one request. But you don't need to worry about this will lost some event if user close the browser suddenly.
Here is the article from Google
Note: When a user's device goes offline (for example, a user loses their internet connection while browsing your mobile app), Google Analytics stores event data on their device and then sends the data once their device is back online. Analytics ignores events that arrive more than 72 hours after the events are triggered.
Link

Google Measurement Protocol advanced e-commerce hits not showing up in Analytics

I'm having issues with tracking advanced e-commerce transactions through Google Measurement Protocol. I want to use this because we can track sales with the most accuracy if it is done server-side. So we take over the cid from the frontend and track a sale as soon as the payment has been done. I have done this before in the exact same way but for some reason it doesn't work this time, or only works around 50% the time, depending on the tracking ID we use.
I am sending the following payload to: https://www.google-analytics.com/collect (changede UA code for the example):
v=1&t=event&tid=UA-MYCODEHERE-1&cid=532571481.1547156684&el=91901.000001&pr1ca=weekendje-weg&ni=1&uid=1337&pr2qt=1&tr=64.65&pr1br=Some%20Location&pr2va=3%20dagen%20-%20Standaardkamer&pr2id=DRTA-4379&ea=purchase&pr1va=3%20dagen%20-%20Standaardkamer&cu=EUR&ta=Some%20Location&pr2ca=weekendje-weg&pr2nm=Some%20Location%20Somewhere&ec=checkout&pr2br=Some%20Location&pr1pr=158.00&pr1qt=1&ti=91901.000001&pr1id=DRTA-4379&pr1nm=Some%20Location%20Somewhere&pa=purchase&pr2pr=158.00&ts=0
This validates in the Hit builder and using the Debug URL, I log all outgoing measurement protocol hits and they are always triggered and always return a status code 200, I have enhanced e-commerce tracking enabled for the tracking id and no filters there (brand new Analytics account) but my hits never show up for this account in Analytics (even after waiting for days still no single measure).
I'm not sure what's going on, I did this before like this and it always worked fine. Am I missing something? I tried switching to measurement protocol via http or https, GET or POST, etc, it all doesn't help. I did have this exact code working for a older property but it wasn't reliably tracking all transactions, now it's just tracking none. I think I tried everything I could, is this a Google Measurement Protocol/Analytics bug or am I missing something?

Google Analytics counting sessions/views twice?

A site I work with recently saw a doubling of it's direct traffic as recorded in Google Analytics. There doesn't seem to be a obvious external reason for the increase (like some promotion or something) so I'm looking into a possible technical reason.
When loading the homepage and monitoring Real Time Traffic Sources, I see two hits in rapid succession each time I reload the page.
However I'm using the GA debugger extension in Chrome and it's only showing the two expected function calls: ga('create') and ga('send', 'pageview').
The site has other event tracking set up but each event is wrapped in an event listener in JS so they aren't firing automatically. And if they were they should show up in the GA debugger anyway
So I'm at a loss. I can't think of why this is happening, let alone just for direct traffic as opposed to other sources. Anyone have any ideas?
Thanks!

Piwik tracking more events than GoogleAnalytics

I have a event that is fired in Piwik and Google Analytics when the pages loads. The event is firing something like "The product was viewed". However, I have a discrepancy between the numbers, in general 9% of difference.
I have the average of 100k events by day.
The server are configured
Load balance
Redis
All optimisations.
I am firing the Google without noninteraction/beacon flag. Can it be a
problem?
Problems can be caused by:
Limit: 500 hits per session
Tracking blockers restricting only GA
Different time of Piwik and UA script execution
Sampling
But do not try to compare two different technologies, you will probably newer have exactly same data. Rather learn about limits and differencies.

Google Tag fires but not logged in Analytics

I had set up my Google Tag to track clicks on spans with certain IDs, the events are firing according to WASP extension, but they are not showing up in my Google Analytics account.
Here is my trigger:
My Tag:
WASP in action:
GA displays pageview only:
Code is installed properly
Sorry if this seems pretty obvious, but in Real Time you should be on the Events tab, and it seems you are looking in the Content tab. Events are never displayed there.
While the configuration looks to be correct, remember that events won't show up in your standard reports until the data is processed, which takes about 24 hours. As long as the hit is showing up in your Real-Time reports, then you shouldn't have any issues.
Can you please post full HTTP request? For instance from Charles Web Debugging Proxy of Live HTTP Headers extension or anything simillar.
What you post seems to be correct as #nyuen says!

Resources