diff --git a/contents/docs/data/anonymous-vs-identified-events.mdx b/contents/docs/data/anonymous-vs-identified-events.mdx index fa2b293bc818..1fc665d3e11d 100644 --- a/contents/docs/data/anonymous-vs-identified-events.mdx +++ b/contents/docs/data/anonymous-vs-identified-events.mdx @@ -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. diff --git a/contents/tutorials/cross-domain-tracking.md b/contents/tutorials/cross-domain-tracking.md index 8fa9b1103e94..cc9a8220478f 100644 --- a/contents/tutorials/cross-domain-tracking.md +++ b/contents/tutorials/cross-domain-tracking.md @@ -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.