Skip to content

fix: merge checkout events onto storefront distinct ids#37

Open
apps3000 wants to merge 1 commit into
celadonworks:mainfrom
apps3000:bvk/storefront-distinct-id-checkout-merge
Open

fix: merge checkout events onto storefront distinct ids#37
apps3000 wants to merge 1 commit into
celadonworks:mainfrom
apps3000:bvk/storefront-distinct-id-checkout-merge

Conversation

@apps3000

@apps3000 apps3000 commented Jun 9, 2026

Copy link
Copy Markdown

Summary

  • Reads _posthog_distinct_id from Shopify checkout/cart attributes passed in from the storefront.
  • Bootstraps PixieHog's PostHog client with the storefront distinct id when it is already present on init cart data.
  • For checkout events, sets the PixieHog distinct id to the storefront id before capture, then identifies that same id with checkout/customer email properties.
  • Keeps the existing email-based fallback only when no storefront distinct id is available.

Why

Tuftinglove's Hydrogen storefront writes the PostHog storefront distinct_id into the Shopify cart as _posthog_distinct_id. PixieHog previously used its own Web Pixel distinct id and later identified by email, so checkout events often landed on a separate PostHog person. Using the storefront id directly lets checkout events merge into the existing storefront person.

Verification

  • npm run build
  • npx eslint extensions/web-pixel/src/index.ts extensions/web-pixel/src/storefront-identity.ts
  • npx tsc --noEmit --pretty false shows no extensions/web-pixel errors; existing unrelated app settings type errors remain in app/routes/app.web-pixel-settings/default-web-pixel-settings.ts.

Notes

  • Direct push to celadonworks/pixiehog-app was not permitted for the apps3000 account, so this PR is opened from the apps3000/pixiehog-app fork.

@apps3000 apps3000 closed this Jun 9, 2026
@apps3000 apps3000 reopened this Jun 9, 2026
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