GTM consent mode Google analytics not tracking pageviews without consent - google-analytics

we have recently implemented cookies consent mode in Google tag manager. Pageviews in google analytics (both universal and GA 4) dropped to about 4 % of the original page views.
When I visit the web page without giving any consent some requests to google-analytics.com still appears in network tab. This tells me something is still tracked. No cookies are saved as expected.
Do you have a different experience? Should GA track pageviews anonymously even without consent or it this a correct behavior? Why would analytics script send any requests if it not appears in GA?

It is expected that you see requests to Google Analytics. However in consent mode you should not see _ga cookies being set (or existing _ga cookies being used). That's basically what consent mode is, cookie-free tracking. You should also see a parameter gcs=100 in the GA request to confirm that consent mode is indeed active.
However these requests are not surfaced in the reports (there would be no point, since without user identifier you cannot create sessions). Apparently they are being used for some sort of Machine Learning thing in the background, but I don't think this has much effect on the analytics part of GA (afaik this is more for Google Ads and GA audiences).
So yes, seeing requests in consent mode is normal (if this helps in any way with GDPR compliance etc. in entirely another matter). If you do not run campaigns and do not hope for an uplift via ML models applied to consent mode data, then you probably do not need to bother and can just disable the tags if no consent is given.

It happens because you have to set ad_storage and analytics_storage as denied by default in initialization code, like described in the documentation (in the example only ad_storage is denied, just add analytics_storage too): https://developers.google.com/tag-platform/devguides/consent#implementation_example

Related

How to implement Google Consent Mode via GTM?

I have a beginner question regarding Google Consent Mode implementation.
I'm installing GCM for the very first time for a client. This client uses Axeptio as CPM.
If I understand correctly, GCM will sent anonymous cookie less data to GA if a user doesn't or hasn't yet given consent. This will allow us to get page views and conversion data.
I read through Axeptio's documents:
https://developers.axeptio.eu/v/francais/cookies/gtag-et-google-consent-mode
https://www.axeptio.eu/post/utiliser-le-google-consent-mode-avec-axeptio
And through articles from Simo Ahava and Google's instructions:
https://www.simoahava.com/analytics/consent-mode-google-tags
https://www.simoahava.com/analytics/consent-settings-google-tag-manager
https://tagmanager.google.com/gallery/#/owners/gtm-templates-simo-ahava/templates/consent-mode
https://support.google.com/tagmanager/answer/10718549
But I'm still having trouble with the implementation. This is where I'm at so far :
I've enabled "Enable consent overview" in the Admin panel in GTM
I installed the HTML code given by Axeptio via GTM (triggered at Consent Initilisation)
I set all the GA tags to "No additional consent required"
I'm not sure what to do next. 
How do I verify that my settings are working? i.e. not give consent and see if my tags are still firing and data is being sent to GA?

Trying to figure out why Google Analyics report more users than our own stack

Comparison is between the Google Analytics script and a "chat widget" loaded in a iframe on the onload event. The iframe is not loaded if the useragentlooks like a crawler. The code in the iframe creates a websocket connection and then a user is upserted in our backend.
I'm looking at one website where we currently get around 2/3 of new users reported by Google Analytics as users in our backend.
With the new Google Analytics UI, it's not clear to me how much crawlers are actually filtered or not (e.g. is Google Analytics always filtering Google Crawler?). That could explain a lot.
Our "tracking id" is saved in localstorage which is a bit more persistent than a cookie, but I can't see it making a big difference.
The extra loading time and the websocket connection can probably explain a bit (old browsers that don't support TLS 1.2, baldy configured proxies, etc) can explain some of it, but 1/3 seems big.
Any insights in Google Analytics metrics or other ideas are welcome.
Bot traffic in Google Analytics is not filtered by default. You can enable it in View Settings.
Also it's possible to pass User Agent strings into Google Analytics as a custom dimension and then create filter to exclude sessions based on User Agents that you know to be bots.
https://www.lunametrics.com/blog/2015/04/01/eliminating-bot-traffic-from-google-analytics-once-and-for-all/
The second reason of difference may be that GA tracker fires when page starts to load, but "chat widget" when window is loaded. Some bounced sessions (and users) are counted by GA, but not counted by "chat widget".

How to track dropout on first screen before tracking consent

It is known that users must explicitly consent the use of tracking tools like Google Analytics, Firebase etc. by the app, I am wondering if it possible to track dropouts on the first screen since as I understand analytics tracking can only be activated once the user allowed this when starting the app for the first time. I would like to know if there are users that exited the app on the first screen before consenting the tracking and decided to uninstall the app after that.
Google Analytics for Firebase provides an API for disabling Analytics collection temporarily before getting a user consent
setAnalyticsCollectionEnabled(true);
You can log this as a event with int parameters 0 and 1 (or any other way you may want). Basically giving you the control and visibility of what you are looking for here.

What might interfere with Google Analytics pageview tracking?

I'm using Google Analytics to send and track a registration goal, based on a custom pageview.
Basically, every time a user registers and gets redirected to dashboard, I trigger a custom pageview using JS:
ga('send', 'pageview', {page: '/gapv/registration/success'});
The tracking works. However, when I compare the GA tracking with the number of registrations from the database of my website, the GA goal completion always shows around 10% less registrations.
I checked the tracking on various desktop browsers, all seems to be fine. Additionally, I hear that content blocking on mobile browsers gets more and more popular.
Is it possible that browser content blocker plugins might block my custom pageview from being fired? I send the pageview on DOM ready.
What else might explain the difference between my DB results and the GA goal count?
Any ideas are very welcome.
Users can opt-out from Google Analytics
Depending on where your tracking code is placed users may leave the page before the hit registers with GA (i.e. users might leave before the DOM is ready - can you move your tracking to pageload ?)
Some Ad blockers block GA, too (some claim this is especially true if you use the "advertising features")
There might be occasional javascript errors that prevent tracking (or users do not have javascript enabled at all)
As a serverside mechanism your database will be more reliable. While you may be able to bring the discrepancy down to single digits it is not likely that the numbers precisely match (even if you do server-side tracking with GA via the measurement protocol you still have to respect user opt-out).

Google Analytics sandbox

I have some problems with the google analytics not working on production, I have made some fixes and used some plugins to check that the information sent to google is ok, but the problem is I cannot test properly on my sandbox since I do not have the credentials for the analytics account used on production instance. I will not have access to that account and I do not want to create a dummy account linked to my sandbox because I cannot have my sandbox address indexed by google. Is there any way to install a local server that emulates GA? Or a way to create a GA account and prevent it from indexing my sandbox address? I have found the urchin software that would have given me the possibility to install a local sandbox, but this was discontinued by google and I was not able to find it anywhere.
If by "indexing" you mean "becoming a part of the Google search index an appearing in result pages", that is not in any way related to analytics. If you have a problem that your pages Urls show up in GA (which really is the whole point of Analytics) you can programmatically pass dummy urls to the tracker:
ga('send', {
'hitType': 'pageview',
'page': '/home' // pass a virtual adress here per page
});
That way your sites structure will not be recognizable in GA (however this will make testing more difficult).
If at all possible you should have Google Tag Manager installed on the live page. GTM has a preview mode that allows you to directly in the live site without affecting other users (tags are only visible to visitors with the preview cookie).
As for emulating locally, no, not really. If you still use asynchronous tracking (ga.js) you can use setlocalGifPath and _setLocalServerMode to have the tracking data send to your own server, but that will not give you the interface - it just means you can create a log file with the google parameters that you have to parse yourself.
Universal Analytics does not (to my knowledge) have corresponding methods (they are a remnant from urchin days when people wanted to reprocess their data locally. As you've said urchin is now defunct and it would have been too expensive for a bit of local testing in any case).

Resources