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: Add customization to add all person profile properties as setPersonPropertiesForFlags #1517

Merged

Conversation

robbie-c
Copy link
Member

@robbie-c robbie-c commented Nov 11, 2024

Changes

Add a customization to set all known person properties with setPersonPropertiesForFlags

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 Nov 11, 2024

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

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Nov 11, 2024 2:55pm

@@ -1,10 +1,10 @@
import { version } from '../package.json'
import packageInfo from '../package.json'
Copy link
Member Author

Choose a reason for hiding this comment

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

I got a warning about this, so I fixed it as a drive-by

Should not import the named export 'version' (imported as 'version') from default-exporting module (only default export is available soon)

Copy link

github-actions bot commented Nov 11, 2024

Size Change: +194 B (+0.01%)

Total Size: 3.01 MB

Filename Size Change
dist/array.full.es5.js 251 kB +22 B (+0.01%)
dist/array.full.js 342 kB +43 B (+0.01%)
dist/array.full.no-external.js 341 kB +43 B (+0.01%)
dist/module.full.js 342 kB +43 B (+0.01%)
dist/module.full.no-external.js 341 kB +43 B (+0.01%)
ℹ️ View Unchanged
Filename Size
dist/all-external-dependencies.js 193 kB
dist/array.js 168 kB
dist/array.no-external.js 167 kB
dist/dead-clicks-autocapture.js 12.8 kB
dist/exception-autocapture.js 8.8 kB
dist/external-scripts-loader.js 2.19 kB
dist/main.js 169 kB
dist/module.js 168 kB
dist/module.no-external.js 167 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

Comment on lines +36 to +39
'$app_build',
'$app_name',
'$app_namespace',
'$app_version',
Copy link
Member

Choose a reason for hiding this comment

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

There are many more params than that such as $device_manufacturer, $device_model, etc, I wonder if this list is exhaustive to only what this SDK specifically collects?

Copy link
Member Author

Choose a reason for hiding this comment

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

Those other ones aren't converted into person properties though, or are they? This list comes straight from plugin-server.

Copy link
Member

Choose a reason for hiding this comment

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

I didn't check so the plugin-server should be up to date and all good.

@@ -31,6 +31,25 @@ export const CAMPAIGN_PARAMS = [
'rdt_cid', // reddit
]

export const EVENT_TO_PERSON_PROPERTIES = [
Copy link
Member

Choose a reason for hiding this comment

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

I think this could do with a comment or a better name...

I think it's saying "these are event properties that we will copy to person properties"
but I don't know for sure 🙈

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't disagree but it's copied directly from plugin server with that name, I'll add a comment though!

import { CAMPAIGN_PARAMS, EVENT_TO_PERSON_PROPERTIES, Info } from '../utils/event-utils'
import { each, extend, includes } from '../utils'

export const setAllPersonProfilePropertiesAsPersonPropertiesForFlags = (posthog: PostHog): void => {
Copy link
Member

Choose a reason for hiding this comment

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

could also do with a comment IMHO, why would I want to do this?

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.

👍

couple of comments but nothing blocking

@robbie-c
Copy link
Member Author

I'm going to merge this now and add a couple of comments in a follow up, just as I'm in a few meetings this morning and it'd be good to get back to the customer asap

@robbie-c robbie-c merged commit 30fc25b into main Nov 15, 2024
13 checks passed
@robbie-c robbie-c deleted the feature/add-customization-to-all-person-properties-as-flags branch November 15, 2024 08:39
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.

3 participants