You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 24, 2023. It is now read-only.
It looks like right now aside from the configuration options, the referrer is only being set from document.referrer which works when the user gets to the site from an external source but not when they are navigating around the site. Also document.referrer doesn't change when navigating within Gatsby so if a user visits multiple pages they will all show the same external referrer. I don't think this is the behavior we want and it's not how it would behave on a traditional non SPA website.
Fortunately, I think an easy fix is we use the prevLocation parameter of onRouteUpdate. If it's not null then we send that as the referrer otherwise we send document.referrrer. (https://www.gatsbyjs.com/docs/browser-apis/#onRouteUpdate)
It looks like right now aside from the configuration options, the
referrer
is only being set fromdocument.referrer
which works when the user gets to the site from an external source but not when they are navigating around the site. Alsodocument.referrer
doesn't change when navigating within Gatsby so if a user visits multiple pages they will all show the same external referrer. I don't think this is the behavior we want and it's not how it would behave on a traditional non SPA website.Fortunately, I think an easy fix is we use the
prevLocation
parameter ofonRouteUpdate
. If it's not null then we send that as the referrer otherwise we senddocument.referrrer
. (https://www.gatsbyjs.com/docs/browser-apis/#onRouteUpdate)Something like:
I'd be happy to submit a PR but wanted to get your thoughts on it first.
Thanks for this handy plugin!
The text was updated successfully, but these errors were encountered: