How to access referer header

I’m trying to use the referer header to do tracking to determine how someone got to our site (Google Ads, Google Organic, Bing Ads, Facebook, etc).

Is there a way to set a cookie with the referer, or pass the referer along the page that is loaded in a param?

Normally if I was using Nginx/Apache I could get it myself, but I’m wonder how to do it when using Netlify? Unfortunately, it seems like using document.referrer isn’t reliable.

Hi, @srchulo, there isn’t any server-side processing at Netlify (with the exception of Functions).

This means that if you want to do this, you’ll need to do this using client-side javascript. Regarding how to do this using client-side javascript, we don’t have any specific recommendation about how to do that.

@luke, okay thanks! It would be great if there was someway to access the headers/info Netlify sees without needing to program using something like Functions. Something like how redirects/headers can be set without writing code. Something with limited functionality, that covers a lot of use cases and allows people to do JAMstack and use something like Netlify over traditional hosting.

Thanks again!

hey @srchulo! interesting suggestion. Maybe you want to write up a feature request for us and post it here?

https://community.netlify.com/c/features/50

Outline your use case as much as possible and why it would be beneficial for our customers to have this - that will definitely help us in making the case for this with our product and engineering teams.