There are two methods to collect cookie banner analytics: using either CookieScript cookie banner analytics tool or Google Analytics 4. You could use CookieScript cookie banner analytics, Google Analytics 4, or both.
You can easily connect Google Analytics 4 with a CookieScript pop-up on your website or app.
See the guides:
How to enable Google Analytics 4?
How to select Google Analytics 4 as your main analytics tool?
How to read Google Analytics 4 statistics?
Watch a video on how to connect Google Analytics 4 and CookieScript:
Besides Google Analytics 4, you can also use CookieScript Cookie Banner Analytics.
Integration with Google Analytics 4 is included in the Plus pricing plan.
How CookieScript + Google Consent Mode Handle Analytics Cookies
If you are using Google Analytics 4 (GA4) together with CookieScript and Google Consent Mode, here is what happens behind the scenes when visitors accept or decline cookies. This explains why certain cookies may still appear in the browser even after consent is withdrawn.
Initial Page Load (Before Consent)
When a visitor first opens your website:
Analytics consent is treated as denied by default.
GA4 does not set or read analytics cookies like
_gaor_gid.If Advanced Consent Mode is enabled, GA4 may send only anonymous, aggregated, cookieless pings until a choice is made.
This behavior is compliant with GDPR and ePrivacy requirements.
When the User Clicks “Accept All”
After the visitor accepts all cookies:
CookieScript sends a consent granted signal to Google.
GA4 switches to full-cookie mode.
Analytics cookies (
_ga,_gid, etc.) are created normally.GA4 tracks visits and events with standard identifiers.
When the User Later Clicks “Decline All”
If the visitor withdraws consent later:
CookieScript updates Google with a consent withdrawn signal.
GA4 immediately switches to restricted, cookieless mode.
Existing analytics cookies may still appear in the browser’s storage, but:
GA4 stops reading or updating them, and
No new analytics cookies are created.
All tracking becomes limited to anonymous, aggregated pings that do not rely on identifiers.
Why Analytics Cookies Are Not Always Deleted
GDPR requires that processing stops after consent is withdrawn. It does not require that cookie files must always be forcibly removed.
Some cookies may remain because:
They were created with certain security flags (e.g.,
Secure,HttpOnly).They were set in ways that cannot reliably be deleted from JavaScript.
Browsers restrict the removal of specific third-party cookies.
What matters is that the cookies are no longer used, not that they no longer exist. CookieScript and Consent Mode ensure GA4 fully stops using them.
How to Verify This Yourself
You can test GA4 consent behavior directly in your browser.
Check GA4 Network Requests
Open your site in Chrome.
Press F12 to open Developer Tools.
Go to the Network tab.
Filter by “collect”.
Reload the page.
After Accepting All Cookies:
Look for GA4 requests containing:
gcs=G111→ consent grantednpa=0→ personalized allowed (if used)
After Declining All Cookies:
Reload and check again:
gcs=G100→ analytics consent deniednpa=1→ non-personalized onlySome setups may also show
pscdl=denied→ cookieless mode
gcs=G100 confirms GA4 is not using analytics cookies.
Check the _ga Cookie
Open Application / Storage in Developer Tools.
Look under Cookies → your domain.
If the user accepted cookies:
_gaand_gidappear and update on reload.
If the user declined cookies:
An existing
_gamay still be present, but it stops updating.New users who decline immediately will not receive a
_gacookie at all.
Summary
Old analytics cookies may remain in storage, but GA4 no longer uses them once consent is denied.
No new analytics cookies are created without explicit consent.
CookieScript and Consent Mode together ensure fully compliant, privacy-respecting behavior.
