Skip to content

Commit

Permalink
Update posthog and move to anonymized events
Browse files Browse the repository at this point in the history
We don't identify users anyway, and this way we take that further to not
even store the anonymous person profiles at all. Posthog also helpfully
charges much less for events without profiles attached. The one identify
case that did exist was for the web post-purchase thank you page. This
attempted to link to the checkoutId from before the purchase to measure
conversion but it actually hasn't worked for a long time (since PayPro
was set up I think?) since we never use the checkoutId beforehand.

For now, this is disabled. In future if we want to track checkout
conversion based on website parameters (e.g. by referrer) then we might
need to find a new solution for that, but happy to ignore it for now.
  • Loading branch information
pimterry committed Nov 26, 2024
1 parent 8031c4b commit 9876783
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
27 changes: 22 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"next-mdx-remote": "^4.4.1",
"next-sitemap": "^4.2.3",
"next-themes": "^0.2.1",
"posthog-js": "^1.57.2",
"posthog-js": "^1.188.1",
"prismjs": "^1.27.0",
"react": "^18.2.0",
"react-countup": "^6.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ export const CapturePurchaseEvent = () => {
const posthog = usePostHog();

const sku = params.get('sku');
const checkoutId = params.get('checkoutId');

if (checkoutId) {
posthog?.identify(checkoutId);
}

const [planName, planCycle] = sku?.split('-') ?? [];
posthog?.capture('Plan purchased', { planName, planCycle, sku });

Expand Down
1 change: 1 addition & 0 deletions src/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if (typeof window !== 'undefined') {
persistence: 'memory', // No cookies/local storage please
advanced_disable_decide: true, // We don't need dynamic features, skip checking
disable_session_recording: true, // Disabled server-side, but disable explicitly here too
person_profiles: 'identified_only' // Use anonymous events - no user profiles
});
}

Expand Down

0 comments on commit 9876783

Please sign in to comment.