Google Analytics (GA4) Cookies Consent

Hi everyone! I’m encountering an issue with Google Analytics cookies. They load as soon as the page loads, which means my cookie consent banner doesn’t seem to have any effect on them and, this, I’m not GDPR compliant.

I’ve already checked the “Do not set cookies on new visitors by default” option, but even after doing that, Google Analytics cookies continue to load when I open my Bubble app.

Here’s some context: I need to track conversions from my main website (domain) to my app (subdomain). To achieve this, I’m using different tags in Google Tag Manager but the same GA4 property for both. I created a cookie consent banner following this tutorial.

Any suggestions or thoughts on how to resolve this issue?

I’ll try to answer. It is possible to enable and disable GA4 cookies per user. I think that is what you are trying to do, offer opt-in and opt-out to GA4. So that no cookie is set on the page load by default.

You’ll need a Plugin or figure out the JavaScript. As you might guess - Google don’t go to the same lengths to explain how to turn off GA4 as they do to set up GA4. :slight_smile: What is a bit naughty of Google is the documentation doesn’t seem to show up in searches. You need to follow a link from stack overflow.

For the JS approach - read this https://developers.google.com/analytics/devguides/collection/gtagjs/user-opt-out
In summary - you have GA set disabled by default and then turn it on per user.

For a plugin - there is a tonne of information here - also talks about GA opt-in. (it’s my commercial plugin but the alternative of hand-crafting some JS is possible)
https://ga4-page-view-demo.bubbleapps.io/version-test

1 Like

Hello! True, information on how to turn off cookies is not as widely available as instructions on how to install and enable them. I’ve gone through the solutions you’ve provided, tried to inject a JavaScript code following this link, but I wasn’t successful.
I installed Google Analytics for Single Page Applications (SPA). It worked on the spot following your tutorial here, it worked wonders, trully!

Lindsay, thank you for your response!

:rofl: I forgot I had made that video

1 Like

Hahaha helped me wonders!

This topic was automatically closed after 70 days. New replies are no longer allowed.