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

Add docs for posthog.createPersonProfile #10522

Merged
merged 3 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions contents/docs/data/anonymous-vs-identified-events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ We derive the following values from the persistence store:

Note that the above initial parameters will only work across subdomains if you're using `persistence: "localStorage+cookie"` (default) or `persistence: "cookie"`.

For cross-domain traffic, or when tracking users between web and mobile, cookie-based data wouldn't be available on the new site, so it's advised to call one of:
* `posthog.identify()` if you have a persistent user ID available, or
* `posthog.createPersonProfile()` if you don't have a persistent user ID. Make sure that you are bootstrapping the PostHog SDK on the new second or mobile app with the anonymous distinct ID from the first site.

Any other initial [person properties](/docs/product-analytics/person-properties#default-person-properties), including initial [GeoIP properties](/docs/product-analytics/person-properties#geoip-properties) will be set from the values in the event at the time that the person profile was created i.e. when the events became identified.
</details>

Expand Down
2 changes: 2 additions & 0 deletions contents/tutorials/cross-domain-tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ First-party cookies ensure you get the most data possible, as third-party cookie

Tracking users across different domains, like `posthog.com` and `hogflix.com`, requires some extra work. You need to pass users' `distinct_id` and `session_id` between PostHog initializations to ensure they are connected. This not only ensures tracking is accurate and consistent, but [session replays](/docs/session-replay/installation#how-to-record-sessions-across-different-domains) and [feature flag evaluations](/docs/feature-flags/bootstrapping) work across domains too.

If you are using anonymous events, call `posthog.identify()` or `posthog.createPersonProfile()` before leaving the first site, to make sure that initial person properties like `$initial_referrer` are set correctly.

### Getting IDs on the first website

To do this, first, we need to get the `distinct_id` and `session_id` from the first website. To do this, we can call `posthog.get_distinct_id()` and `posthog.get_session_id()` and pass them in the URL hash to the second domain.
Expand Down