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

Feature Request: Mechanism to Avoid Duplicate User Identification in PostHog #1110

Open
Davidmycodeguy opened this issue Apr 2, 2024 · 0 comments

Comments

@Davidmycodeguy
Copy link

Summary:

In applications, particularly those using backend authentication like with Supabase, there’s a lack of a clear event on the front-end to trigger user identification for analytics. This scenario can lead to challenges in properly identifying users without causing duplicate identification events in PostHog. Currently, PostHog does not offer a built-in method to check if a user has already been identified, which can lead to redundant data collection and inaccuracies in user tracking.

Problem Statement:

Our application utilizes Supabase for authentication, where the authentication process is managed through backend routes, and no distinct front-end event is triggered for user logins. This setup necessitates a workaround for identifying users on the front-end, which we’ve attempted with local storage and React’s useState effect. However, this approach has proven to be less than ideal, sometimes causing the ‘identify’ event to trigger multiple times for a single user session. This issue could potentially lead to skewed analytics and user data.

Current Workaround:

We have attempted to mitigate this issue by using a combination of local storage and a ‘useState’ effect in our front-end code to check for user identification. This solution, however, is not foolproof and has led to instances of duplicate identifications.

Proposed Solution:

I propose that PostHog introduces a feature or mechanism that allows developers to check if a user has already been identified in the current session or through a persistent session marker. Such functionality could resemble a method similar to posthog.__loaded but specifically for checking user identification status, e.g., posthog.__identified.

This feature would greatly enhance the developer’s ability to manage user identification efficiently, especially in applications where authentication is handled outside of traditional front-end events.

Impact:

Implementing this feature would significantly improve data accuracy for developers leveraging PostHog for user analytics, especially in complex authentication setups. It would reduce redundancy in data collection and ensure a more accurate representation of user sessions and interactions with the application.

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

No branches or pull requests

1 participant