Skip to content

Delegate async consent initialization to consent-tracking-api - #3963

Open
frandiox wants to merge 4 commits into
fd-server-timing-refactorfrom
fd-consent-integration
Open

Delegate async consent initialization to consent-tracking-api#3963
frandiox wants to merge 4 commits into
fd-server-timing-refactorfrom
fd-consent-integration

Conversation

@frandiox

Copy link
Copy Markdown
Contributor

Stacked on #3960.

TL;DR: Delegate initial asynchronous consent loading to consent-tracking-api instead of maintaining a second orchestration path in Hydrogen.

Before

Hydrogen injected a consent bootstrap that called setTrackingConsent, tracked readiness, and annotated consent events. This duplicated behavior that now belongs to consent-tracking-api.

After

Hydrogen enables asynchronous consent and visitor state in the Shopify global config. The analytics bus installs its listeners before the async consent library, treats consentTrackingApiLoaded as initial readiness, and treats visitorConsentCollected as a shopper interaction.

What this changes

  • Removes Hydrogen's manual consent request and event-source bootstrap.
  • Keeps analytics buffering blocked until consent is ready, including the default-banner pre-interaction state.
  • Revalidates connected cart checkout URLs and deprecated-cookie synchronization after both initial readiness and later consent changes.
  • Preserves existing asynchronous visitor-state behavior through asyncVisitorState.

Developer impact

No public Hydrogen API is added. No changeset is included because this PR refines the unreleased ShopifyScripts behavior introduced by the stacked base branch.

Risk

  • This integration depends on matching consent-tracking-api and privacy-banner releases that provide asynchronous initialization and readiness semantics.
  • The Hydrogen change must not ship before those CDN releases are available.

@frandiox
frandiox requested a review from a team as a code owner August 20, 2026 15:55
frandiox and others added 3 commits August 21, 2026 17:28
Let consent-tracking-api own initial consent readiness and visitor-state loading so Hydrogen no longer duplicates request and event orchestration. Install analytics listeners before the async consent script, preserve cart and deprecated-cookie refreshes across readiness and interaction events, and retain the existing asynchronous visitor-state behavior.

Co-authored-by: Codex <codex@openai.com>
Use consent-tracking-api's canonical GDPR banner decision so Hydrogen does not duplicate consent-state semantics.

Co-authored-by: Codex <codex@openai.com>
@frandiox
frandiox force-pushed the fd-consent-integration branch from 344c087 to bf93e17 Compare August 21, 2026 08:32
The consent-tracking API and privacy banner releases are now available from their canonical CDN URLs, so the temporary checked-in bundles and local paths are no longer needed.

This reverts commit bf93e17.

Co-authored-by: Codex <codex@openai.com>
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