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

feat: Only set missing campaign params to null if there is at least one non-null #1493

Merged

Conversation

robbie-c
Copy link
Member

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

Changes

See this ticket https://posthoghelp.zendesk.com/agent/tickets/19698

We definitely want to keep something similar to the changed logic. i.e. if one session has utm_source = source, and the next session has utm_medium = medium.

However, we could prevent overwriting the campaign params if there are none set.

Had a discussion with @neilkakkar about it here https://posthog.slack.com/archives/C05LJK1N3CP/p1729764244044729

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

Copy link

vercel bot commented Oct 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Oct 23, 2024 7:05pm

Copy link

Size Change: +748 B (+0.03%)

Total Size: 2.89 MB

Filename Size Change
dist/array.full.es5.js 248 kB +74 B (+0.03%)
dist/array.full.js 335 kB +76 B (+0.02%)
dist/array.full.no-external.js 334 kB +76 B (+0.02%)
dist/array.js 156 kB +74 B (+0.05%)
dist/array.no-external.js 155 kB +74 B (+0.05%)
dist/main.js 156 kB +74 B (+0.05%)
dist/module.full.js 334 kB +76 B (+0.02%)
dist/module.full.no-external.js 334 kB +76 B (+0.02%)
dist/module.js 156 kB +74 B (+0.05%)
dist/module.no-external.js 155 kB +74 B (+0.05%)
ℹ️ View Unchanged
Filename Size
dist/all-external-dependencies.js 182 kB
dist/exception-autocapture.js 8.75 kB
dist/external-scripts-loader.js 2.19 kB
dist/recorder-v2.js 102 kB
dist/recorder.js 103 kB
dist/surveys-preview.js 56.7 kB
dist/surveys.js 62.1 kB
dist/tracing-headers.js 1.33 kB
dist/web-vitals.js 10.3 kB

compressed-size-action

@robbie-c robbie-c changed the title Only set missing campaign params to null if any are set feat: Only set missing campaign params to null if any are set Oct 24, 2024
@robbie-c robbie-c changed the title feat: Only set missing campaign params to null if any are set feat: Only set missing campaign params to null if there is at least one non-null Oct 28, 2024
@robbie-c robbie-c added the bump minor Bump minor version when this PR gets merged label Oct 28, 2024
// only save campaign params if there were any
if (!isEmptyObject(stripEmptyProperties(campaignParams))) {
this.register(Info.campaignParams(this.config.custom_campaign_params))
}
this.campaign_params_saved = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we only be marked them as saved when we did send something or doesn't matter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag is there to make sure we get the campaign params from the start of the session only, so I think it's correct as is. We want to set the flag regardless of whether we save anything, so that we don't pick up campaign params from later in the session.

@robbie-c robbie-c merged commit dd8735e into main Oct 28, 2024
22 of 24 checks passed
@robbie-c robbie-c deleted the feature/only-set-properties-to-null-when-any-are-present branch October 28, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump minor Bump minor version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants