Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Set campaign params to null on person creation #25132

Closed

Conversation

robbie-c
Copy link
Member

@robbie-c robbie-c commented Sep 23, 2024

Problem

See #7710

Campaign params can be set on a later visit, so a user that was originally organic traffic (no campaign params) could be attributed to a different channel if they click a link with a UTM tag set

TRICKY: To make upgrading anonymous users work, the pipeline now assumes that if you send any $initial props, you will send all relevant $initial campaign params, as this is what posthog-js does. To sanity-check this, I added a counter in #25169 to see if this would negatively affect anyone, see this grafana chart. It only says web, which is expected, and the fact that no other SDKs are present means that this would not negatively impact anyone.

Changes

On person creation, set all known campaign params to null, so that if they are not set when the person is created, they cannot overridden later on.

This is the 80/20 solution, it's possible to come up with edge-cases that would be fixed by a more complex implementation (see #25135), but given we don't want to touch the person properties code too much at the moment, let's go for this fix.

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

Added some tests - also the grafana chart shows the impact of this change in prod

@robbie-c robbie-c force-pushed the fix/set-campaign-params-to-null-on-person-creation branch from 7126a45 to f9e19e5 Compare September 23, 2024 10:58
@robbie-c robbie-c force-pushed the fix/set-campaign-params-to-null-on-person-creation branch from f9e19e5 to 42762e8 Compare September 24, 2024 10:04
@robbie-c robbie-c force-pushed the fix/set-campaign-params-to-null-on-person-creation branch from 42762e8 to 36b10f3 Compare September 26, 2024 12:00
@robbie-c robbie-c force-pushed the fix/set-campaign-params-to-null-on-person-creation branch from aa95be6 to 8014ce6 Compare September 26, 2024 12:30
@robbie-c robbie-c changed the title fix: WIP Set campaign params to null on person creation fix: Set campaign params to null on person creation Sep 26, 2024
@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the waiting label.

@posthog-bot
Copy link
Contributor

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants