Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pageviews should be unique when Cloudflare's under attack mode is on #48

Open
adriaandotcom opened this issue Oct 16, 2024 · 1 comment

Comments

@adriaandotcom
Copy link
Collaborator

We can check this with ?__cf_chl_tk=... in the referrer URL.

@Khodl
Copy link

Khodl commented Feb 11, 2025

That would be great!

If I am not mistaken, if we include the SimpleAnalytics script on the "under attack" page, the script is not executed at all. It is okay, as the opposite would systematically add one page view to each session.

I investigated a bit more on the second page (the one loaded after the redirection from the "under attack" page), and it receives a referer [sic] header server-side, and the value includes the original external source. This header seems to be be added by Cloudflare when calling the backend, and does not provide the same value as document.referrer (which is not the original, but the __cf_chl_tk= one)

Maybe a solution would be to force a specific referrer when loading the script, the same way you do the overwrite domain name, such as a data-referrer attribute? The advantage of that solution is that it is provider-agnostic, and it includes the original referrer instead of an unknown one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants