Skip to content

Commit d900d38

Browse files
authored
Add docs for posthog.createPersonProfile (#10522)
* Add docs for posthog.createPersonProfile * Add docs for cross-domain tracking * Update contents/tutorials/cross-domain-tracking.md
1 parent 7a846a3 commit d900d38

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

contents/docs/data/anonymous-vs-identified-events.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ We derive the following values from the persistence store:
199199

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

202+
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:
203+
* `posthog.identify()` if you have a persistent user ID available, or
204+
* `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.
205+
202206
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.
203207
</details>
204208

contents/tutorials/cross-domain-tracking.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ First-party cookies ensure you get the most data possible, as third-party cookie
2424

2525
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.
2626

27+
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.
28+
2729
### Getting IDs on the first website
2830

2931
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.

0 commit comments

Comments
 (0)