Google Analytics with too low of bounce rate - google-analytics

I'm looking for some assistance here. We're seeing a very low bounce rate (3%) which i know can't be possible.
The analytics appears to be setup incorrectly on our site. We see a lot of event tracking that happens automatically so i'm pretty sure this is our problem. Here is the code we're seeing that was implemented in what looks to be twice. Which do we need to get rid of?
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx-
1`enter code here`"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxx-1');
</script>
Any help is appreciated.
Thanks,
gr8rck

The snippet you've provided looks fine. If the same set of code has been provided twice, remove one of the instances.
You mentioned that a series of events fire automatically. This is most likely what is causing an artificially low bounce rate.
If these events fire without user involvement, my suggestion is that you define them as non-interaction events. The events will still record, but will not count as a true user interaction. Therefore your bounce rate will be unaffected.
You would send a non-interaction event like so:
gtag('event', 'my_event_action', {
'event_label': 'my_event_label',
'event_category': 'my_event_category',
'non_interaction': true
});

Related

Using transport_type "beacon" does not hide parameters in Google Analytics 4

Maybe I'm missing something here, but in Google Analytics V3 (analytics.js or gtag.js) setting the transport or transport_type to beacon would make the request to google-analytics.com/x/collect be sent using POST, i.e. no GET-parameters would be shown in the request URL.
When using GA4 (and a G- measurement ID) setting this parameter does nothing. This is what my tracking code looks like:
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXX', {"transport_type":"beacon"});
Am I doing something wrong, or am I simply misinterpreting how the beacon works in GA4? If the latter, is there any way to make GA4 function in a similar manner? What I'd like to achieve is send requests, that look like:
https://www.google-analytics.com/g/collect
As opposed to:
https://www.google-analytics.com/g/collect?param=1&param_2=2&etc=etc
Hopefully someone'll be able to help me out, as the documentation is very limited ATM.
In Firefox in Network section of developer tools you can see the initiator of hit, and it say the way how hit was sent. If you see something like js.56 (beacon) you can be sure that hit was sent via navigator.sendBeacon() method of Beacon API
Setting parameter transport_type to beacon indeed do nothing, because ga4 hits are sent using this method by default.

Google Analytics is showing "Avg. Page Load Time" always as Zero

My google analytics script is like this
< !--Global site tag(gtag.js) - Google Analytics-- >
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx-x"></ script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxx-x', { 'page_path': curpath });
</script>
Thiw works fine except Avg. Page Load Time is not getting logged in analytics (always shows as zero). What am I missing here?
Note: My site works on ajax calls with single URL
You are missing the necessary information from the browser, since you use AJAX calls.
Google Analytics uses the Navigation Timing API, which is quite reliable, since the actual measurement is done by the browser and the values can be read as properties of the window.performance.timing object.
Example from here:
Calculate the total page load time
const perfData = window.performance.timing;
const pageLoadTime = perfData.loadEventEnd - perfData.navigationStart;
Your Ajax call does not populate those values (which in a way makes sense, since the corresponding DOM events are not populated in an AJAX call), so GA cannot log a page load time.
You can do custom user timings in GA. They will be limited to a sample of 1% of your calls max, and your averages will be extrapolated from there. You would pass in the delta between the start of your Ajax call and the point at which the response is rendered.

Google Analytics showing partial data in magento

Have just done a migration from 2.2.2 to 2.3.3.
Initially once migration was completed, no data at all was recording in google analytics screen.
We the checked Analytics setting in the backend of the store:
Stores>Configuration>Sales>Google API>Google Analytics
It was disabled so we enabled it.
Prior to migration, daily new users: 500.
After migration, daily new users for the last 2 days: 140.
Conversions: unaffected
Conclusion: analytics is not recording the data correctly.
Can anyone advise what else could be investigated why the data isn't accurate after 48hrs+?
and I can see also some google code in:
public_html/app/design/frontend/[vendor name]/[theme name]/Magento_Theme/templates/html/footer.phtml
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXX-X');
</script>```
The code is the standard one (it shouldn't be in the footer but in the header) and it track the pageviews, if it is in all pages you should have no user or session detection issues. Check if it is present on all pages. In addition, on the purchase confirmation page there must be the transaction code in addition to the one you entered here.

Google analytics event tracking (gtag) not displaying

I'm trying to setup event tracking for google analytics, and I've got the following code:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config','UA-XXXXXXXX-1');
</script>
onclick="javascript:gtag('event','Download',{'event_category':'Teacher Guide - Agroforestry','event_label':'Teacher Resource','value':'Teacher Resource'});"
It's displaying under Real-Time > Events if I click on the link, but it doesn't display under Behaviour -> Events -> Overview.
Could someone tell me if I'm missing something, or if I've set it up incorrectly?
It seems like you are using GA free.
If you are seeing the events real time, then you need to wait for at least 24-72 hrs to get the data updated under Behaviour -> Events -> Overview.
If you are a GA 360 customer, then you have to wait about 2 hrs to get the data in the reports

Using a Google Analytics custom dimension for pageview statistics widget

I have a custom dimension that is being set with a gtag tracking code. I can actually see that the values are being send to GA and can, for example, make dashboard widgets with it.
The odd thing is that when I make a widget with sessions and the dimension it works well, but if I want to make a widget with pageviews and the dimension it returns no data at all.
This is my tracking code:
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-0000000-0', {"anonymize_ip":true,"custom_map":{"dimension1":"premium"}});
gtag('set', 'premium', {'premium': 'premium post and not subscribed'});
I've also, instead of using 'set' tried using 'event' but this did not solve the issue. It looks like the custom dimension is not being collected with pageviews, but with sessions only.
Does anyone know if I have to configure it differently to also make it work for pageviews?
Since your custom dimension is configured at the hit level it needs to be associated with either an event or pageview hit. Your code looks like it simply sets the custom dimension value, but it's not followed by a pageview hit call. Try swapping the idea of your calls instead:
gtag('set', 'premium', {'premium': 'premium post and not subscribed'});
gtag('config', 'UA-0000000-0', {"anonymize_ip":true,"custom_map":{"dimension1":"premium"}});

Resources