Skip to content

WEB-4715 Treat visitors as EU when location.js does not load - #114

Open
czechian wants to merge 1 commit into
masterfrom
WEB-4715-location-fallback
Open

czechian wants to merge 1 commit into
masterfrom
WEB-4715-location-fallback

Conversation

@czechian

@czechian czechian commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #113 (WEB-4715), from CodeRabbit's review of gooddata/gdc-cloud-docs#1955.

If location.js is blocked or fails to load, window.isEU is undefined. cookies.js treats that as a non-EU visitor and sends a granted consent default, so _ga cookies and Clarity ran before an EU visitor agreed. gtm.html now sets window.isEU = true when location.js did not define it, so the visitor gets the EU banner and consent stays denied until they accept.

Tested with the built gdc-cloud-docs output on the live Cloud docs, using the real cookies.js and Tag Manager container:

Visitor Before After
location.js blocked _ga set, Clarity loads No _ga, no Clarity, EU banner
EU first visit, EU returning (accepted / denied / analytics only), outside the EU Correct Unchanged

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Consent defaults now use EU settings when no EU status has been set. This may affect which consent options are presented to visitors whose regional status is otherwise unspecified. No other user-facing changes are included in this update.

cookies.js reads a missing window.isEU as non-EU and sends a granted
consent default, so a blocked or failed location.js let analytics and
Clarity run before an EU visitor agreed.
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The GTM partial now sets window.isEU to true when it is undefined, before configuring consent defaults. Existing values remain unchanged.

Changes: EU Consent Default

Layer / File(s) Summary
Initialize the EU flag
layouts/partials/gtm.html
When window.isEU is undefined, the partial sets it to true. Existing values remain unchanged.

Estimated code review effort: 2 (Simple) | ~5 minutes

Possibly related PRs

Suggested reviewers: subtachyon

Merge Risk: Minimal · up to 9e8cb

When the location script fails to load, visitors are now treated as EU visitors and see the consent banner, with analytics denied until they accept. Behavior for visitors whose location loads correctly is unchanged. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: visitors are treated as EU when location.js does not load. The raw summary confirms that gtm.html sets window.isEU to true when it is undefined, which matches the title. Th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: visitors are treated as EU when location.js does not load. The raw summary confirms that gtm.html sets window.isEU to true when it is undefined, which matches the title. The ticket ID prefix is acceptable and the title is specific enough for a teammate scanning history.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the page at dawn
An undefined flag is soon set on
Existing values stay in place
Consent defaults follow at pace
The rabbit hops through code with cheer

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 5c15946c-2bb6-4487-a77e-18e7bc0d3fd0
Commits

Reviewing files that changed from the base of the PR and between 3922b13 and 9e8cb69.

Files selected for processing: 1

  • layouts/partials/gtm.html

Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant