Skip to content

Commit 9876783

Browse files
committed
Update posthog and move to anonymized events
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.
1 parent 8031c4b commit 9876783

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

package-lock.json

+22-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"next-mdx-remote": "^4.4.1",
4444
"next-sitemap": "^4.2.3",
4545
"next-themes": "^0.2.1",
46-
"posthog-js": "^1.57.2",
46+
"posthog-js": "^1.188.1",
4747
"prismjs": "^1.27.0",
4848
"react": "^18.2.0",
4949
"react-countup": "^6.5.0",

src/app/(thank-you-pages)/web-purchase-thank-you/capture-purchase-event.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ export const CapturePurchaseEvent = () => {
88
const posthog = usePostHog();
99

1010
const sku = params.get('sku');
11-
const checkoutId = params.get('checkoutId');
12-
13-
if (checkoutId) {
14-
posthog?.identify(checkoutId);
15-
}
16-
1711
const [planName, planCycle] = sku?.split('-') ?? [];
1812
posthog?.capture('Plan purchased', { planName, planCycle, sku });
1913

src/app/providers.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ if (typeof window !== 'undefined') {
1010
persistence: 'memory', // No cookies/local storage please
1111
advanced_disable_decide: true, // We don't need dynamic features, skip checking
1212
disable_session_recording: true, // Disabled server-side, but disable explicitly here too
13+
person_profiles: 'identified_only' // Use anonymous events - no user profiles
1314
});
1415
}
1516

0 commit comments

Comments
 (0)