-
Notifications
You must be signed in to change notification settings - Fork 25
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
add support to person profiles #171
add support to person profiles #171
Conversation
…ct internal logic
posthog/src/main/java/com/posthog/internal/PersonProfileMode.kt
Outdated
Show resolved
Hide resolved
posthog/src/main/java/com/posthog/internal/PersonProfileMode.kt
Outdated
Show resolved
Hide resolved
Add a TODO somewhere that we need to implement |
I think this check is also missing somewhere https://github.com/PostHog/posthog-js/blob/34204f4aff107162bdb259d2a7c855d67bf0260c/src/posthog-core.ts#L829 which is about setting |
I will fix all that you commented, soon update |
I'm sorry @marandaneto, I thought the implementation of this feature was based solely on the documentation. I didn't realize there was already a reference implementation for it, which is why my code looks confusing, as I developed it from my own logic. I now understand exactly how to do it correctly, but I still have a few questions. In the
But in the actual posthog-js implementation, it seems to process any type of event, or am I mistaken? Additionally, in this PR, is it necessary to implement the persistence mechanism, like for dataSetOnce, for example? |
the flag is set for any type of event, the same as the JS implementation. |
@marandaneto I updated the PR with only what's necessary to make the personProfiles config feature work. Just the hasPersonProcessing function solves the problem. However, I introduced a complete version with the dependencies that complete the personProfile feature. If possible, take a look at this version and see if it makes sense. Based on my tests in core-js and in this version's code, everything seems fine. Please analyze whether it makes sense to include this in the PR or leave it for later. |
you can run |
About the commit thisames@0f0c39a |
…_profile are setting correctly
@thisames see my PR PostHog/posthog-ios#187 |
- Introduced 'ENABLE_PERSON_PROCESSING' to control person processing logic. - Added `requirePersonProcessing` method to validate if person processing is enabled before capturing events like 'alias', 'identify', and 'group'. - Modified `capture` method to enforce person processing when necessary properties are provided. - Enhanced `hasPersonProcessing` to check against the new 'ENABLE_PERSON_PROCESSING' preference. - Updated methods `alias`, `identify`, and `group` to respect person processing rules. - Improved logging for clearer debugging.
@thisames I pushed a few changes to fix and improve a few things, thanks for the PR. |
💡 Motivation and Context
This PR adds support for the
personProfiles
configuration option in the PostHog SDK. ThepersonProfiles
option allows users to control how person profile data is processed during various events.reference
https://github.com/PostHog/product-internal/pull/637
https://github.com/PostHog/posthog-js/blob/0b40e5af5381c7d356de31fc0458e91afbfa9a6b/src/types.ts#L206-L213
fix #159
💚 How did you test it?
Manually tested by sending multiple events to the PostHog dashboard with all three
personProfiles
settings ("always", "never", "identified_only") to confirm that the events are processed according to the expected behavior for each setting.Added unit tests in
PostHogTest
to verify the behavior of thepersonProfiles
setting:personProfiles
is set to "always".personProfiles
is set to "never".personProfiles
is set to "identified_only".personProfiles
is set to "identified_only".personProfiles
is set to "never" or "identified_only", the flagprocess_person_profile
is added to the "screen" event, but the event still appears on the dashboard. This behavior is unexpected, as the flag should filter out the event, preventing it from showing up on the dashboard. It seems that additional logic may be needed to properly handle "screen" events according to thepersonProfiles
setting.📝 Checklist