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: Deprecate sanitize_properties #1632

Merged

Conversation

rafaeelaudibert
Copy link
Member

Changes

We can achieve the exact same outcome we achieve with sanitize_properties by using before_send which is a much more compreheensive function, with better usability and ergonomics.

We can't remove this function without a major, so let's deprecate it and issue a console warning when it's used.

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!)

Sorry, something went wrong.

@rafaeelaudibert rafaeelaudibert requested review from pauldambra and a team December 27, 2024 14:53
Copy link

vercel bot commented Dec 27, 2024

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

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Dec 27, 2024 3:00pm

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
We can achieve the exact same outcome we achieve with `sanitize_properties` by using `before_send` which is a much more compreheensive function, with better usability and ergonomics.

We can't remove this function without a major, so let's deprecate it and issue a console warning when it's used.
@rafaeelaudibert rafaeelaudibert force-pushed the deprecate-sanitize-properties-over-before-send branch from 8d54002 to 6bd0137 Compare December 27, 2024 14:55
@rafaeelaudibert rafaeelaudibert added the bump minor Bump minor version when this PR gets merged label Dec 27, 2024
Copy link

github-actions bot commented Dec 27, 2024

Size Change: +1.41 kB (+0.04%)

Total Size: 3.22 MB

Filename Size Change
dist/array.full.es5.js 262 kB +142 B (+0.05%)
dist/array.full.js 365 kB +142 B (+0.04%)
dist/array.full.no-external.js 364 kB +142 B (+0.04%)
dist/array.js 179 kB +140 B (+0.08%)
dist/array.no-external.js 178 kB +140 B (+0.08%)
dist/main.js 180 kB +140 B (+0.08%)
dist/module.full.js 365 kB +142 B (+0.04%)
dist/module.full.no-external.js 364 kB +142 B (+0.04%)
dist/module.js 179 kB +140 B (+0.08%)
dist/module.no-external.js 178 kB +140 B (+0.08%)
ℹ️ View Unchanged
Filename Size
dist/all-external-dependencies.js 206 kB
dist/customizations.full.js 12.6 kB
dist/dead-clicks-autocapture.js 14.4 kB
dist/exception-autocapture.js 9.48 kB
dist/external-scripts-loader.js 2.64 kB
dist/recorder-v2.js 115 kB
dist/recorder.js 115 kB
dist/surveys-preview.js 57.6 kB
dist/surveys.js 63.3 kB
dist/tracing-headers.js 1.76 kB
dist/web-vitals.js 10.4 kB

compressed-size-action

rafaeelaudibert added a commit to PostHog/posthog.com that referenced this pull request Dec 27, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
We're deprecating `sanitize_properties` on PostHog/posthog-js#1632, so let's suggest using `before_send` everywhere where we previously suggested `sanitize_properties`
@rafaeelaudibert
Copy link
Member Author

Website update to suggest before_send over sanitize_properties: PostHog/posthog.com#10229

Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

yep, this is even better since sanitize_properties is called on properties and $set_once but not on $set

@posthog-bot
Copy link
Collaborator

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.

@rafaeelaudibert rafaeelaudibert merged commit 1f5680d into main Jan 6, 2025
34 checks passed
@rafaeelaudibert rafaeelaudibert deleted the deprecate-sanitize-properties-over-before-send branch January 6, 2025 13:58
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 stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants