epicweb-dev / epic-stack

This is a Full Stack app starter with the foundational things setup and configured for you to hit the ground running on your next EPIC idea.
https://www.epicweb.dev/epic-stack
MIT License
4.47k stars 368 forks source link

All traffic marked as direct in analytics (GA4 and Fathom) #580

Closed bradymwilliams closed 9 months ago

bradymwilliams commented 9 months ago

Recently migrated to the Epic Stack from a custom stack hosted on Vercel

Using the default epic stack server/index.ts all traffic in analytics has switched from Organic Seo to Direct in multiple analytics providers so I think theres a problem I don't understand in the redirects middlewares?

kentcdodds commented 9 months ago

That's odd. The Epic Stack doesn't track analytics so I can't determine whether the Epic Stack actually has that same issue, but the Epic Stack is largely based on my personal website and my analytics definitely shows referrers. I'm afraid I don't know what could be causing your issues 😬

bradymwilliams commented 9 months ago

Fair enough. Curious are you pointing both www and @ sites to the same app in Fly? Wondering if a redirect there is at play.

kentcdodds commented 9 months ago

There's no automatic redirect (though I considered doing that).

kentcdodds commented 9 months ago

@bradymwilliams did you figure out what the problem was?

bradymwilliams commented 8 months ago

@kentcdodds Not when you asked this, but I believe I just barely have. The client-hints script runs and on cookie changes runs window.location.reload(); which refreshes and sets the referrer to the current page (which makes sense). Given its inline it hits before analytics does.