Use Netlify Edge Functions to intercept a request to a static page, check the value of the HTTP referer header, and enhance the response of the HTML before it's returned to the browser. No client-side JavaScript required.
Why do you think that https://github.com/11ty/eleventy is a good alternative to personalize-with-http-referer