Features
Utilize advanced features and integrate CookiePal with other tools.
Integrate Firebase Analytics via GTM with CookiePal
Step-by-step guide to connect Firebase Analytics with CookiePal using Google Tag Manager
Table of contents
back
to the top
Firebase Analytics is a powerful tool for tracking user behavior across your app or website.
When integrated through Google Tag Manager (GTM), it provides a flexible and scalable way to manage analytics.
To ensure compliance with privacy regulations like GDPR and Google Consent Mode v2,
Firebase must only start tracking after the user gives consent.
This guide explains how to configure Firebase Analytics via GTM and how CookiePal automatically manages consent signals on your behalf.
Add Firebase to Your GTM Container
First, you must configure Firebase Analytics themselves:
• In the Firebase Console, enable Google Analytics for your project and add a new Web or App stream if needed—this creates a measurementId or config.
• Navigate to Integrations > Google Tag Manager in Firebase and link your GTM workspace to your Firebase project.
• In Google Tag Manager, create a new container (Web), and configure tags that load the Firebase Analytics SDK and initialize it with your Firebase project settings.
If you already have a container for your website, please use it instead.
What CookiePal Does Behind the Scenes
Once the merchant has GTM set to load Firebase Analytics:
• CookiePal’s banner checks for Firebase on page load.
• If the visitor has already granted Analytics/Marketing consent, CookiePal automatically calls `firebase.analytics().setConsent({...})`.
• If consent is given later via the banner, CookiePal sets consent at that moment.
• It handles all four consent flags: `analytics_storage`, `ad_storage`, `ad_user_data`, and `ad_personalization`, in line with Google Consent Mode v2.
Why This Works
CookiePal only sends consent signals—it does not load or initialize Firebase. That remains under merchant control.
Once consent is granted, signals are passed immediately and transparently to Firebase Analytics via GTM setup.
✅ Merchant action: only set up Firebase in GTM as normal.
✅ CookiePal action: automatically detects and updates Firebase consent as needed.
If you would like to check a more in-depth guide, please refer to GTM + Firebase integration guidance like:
• Set consent mode via GTM
• Acceptance logic for Firebase integration