Describe the bug
When using the Snowplow JavaScript tracker in a single-page application (SPA), the trackPageView event for client-side navigations sets the referrer to the previous internal route, rather than the original external referrer. For example, when a user lands on the site from Google, the first page view correctly reports google.com as the referrer. However, subsequent SPA navigations tracked by trackPageView report the previous internal URL as the referrer. This makes it difficult to consistently determine how the user originally arrived at the site across their session.
To Reproduce
- Open a browser and enter your SPA after searching in Google. (Referrer is
google.com.)
- Client-side navigation occurs and you trigger Snowplow's
trackPageView for the new virtual route.
- Open Snowplow console/debug logs or data collector: the new event shows the previous SPA route as the referrer instead of
google.com.
Expected behavior
It should be possible to consistently track the original external referrer (e.g., google.com) on all subsequent SPA navigations, or there should be documented guidance/best-practice around tracking both original and previous internal referrer.
Screenshots
N/A
Desktop (please complete the following information):
- OS: [Any]
- Browser: [Any]
- Version: [Any]
Smartphone (please complete the following information):
- Device: [Any]
- OS: [Any]
- Browser: [Any]
- Version: [Any]
Additional context
There is a workaround (documented) to capture and store the initial external referrer and then provide it manually in each trackPageView. However, many users may expect Snowplow to provide the original referrer automatically or document this as a core integration step for SPAs.
Describe the bug
When using the Snowplow JavaScript tracker in a single-page application (SPA), the
trackPageViewevent for client-side navigations sets the referrer to the previous internal route, rather than the original external referrer. For example, when a user lands on the site from Google, the first page view correctly reportsgoogle.comas the referrer. However, subsequent SPA navigations tracked bytrackPageViewreport the previous internal URL as the referrer. This makes it difficult to consistently determine how the user originally arrived at the site across their session.To Reproduce
google.com.)trackPageViewfor the new virtual route.google.com.Expected behavior
It should be possible to consistently track the original external referrer (e.g.,
google.com) on all subsequent SPA navigations, or there should be documented guidance/best-practice around tracking both original and previous internal referrer.Screenshots
N/A
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
There is a workaround (documented) to capture and store the initial external referrer and then provide it manually in each
trackPageView. However, many users may expect Snowplow to provide the original referrer automatically or document this as a core integration step for SPAs.