Skip to content

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

Description

@adriaandotcom

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

Activity

  1. Khodl commented on Feb 11, 2025

    @Khodl

    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.

  2. adriaandotcom commented on Jun 13, 2025

    @adriaandotcom
    CollaboratorAuthor

    Fixed in #40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions