Skip to content

Install

Proxy the script through your domain

Some ad blockers block requests to analytics domains. Serve the script from your own domain to track visitors who use them.

Best for
Developers who manage your web server
Prerequisites
Access to your web server's configuration.
  1. Step 1: Proxy two paths

    Your server serves the script at /stats/script.js and forwards /stats/collect to our collector. Add this to your server config, then reload the server.

    location = /stats/script.js {
        proxy_pass https://staging-script.pebbleanalytics.io/s/YOUR-SITE-ID.js;
        proxy_set_header Host staging-script.pebbleanalytics.io;
        proxy_ssl_server_name on;
    }
    
    location = /stats/collect {
        proxy_pass https://staging-script.pebbleanalytics.io/event;
        proxy_set_header Host staging-script.pebbleanalytics.io;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_ssl_server_name on;
    }

  2. Step 2: Update your snippet

    Load the script from your own path and add data-api so pageviews are sent there too.

    HTML
    <script async src="/stats/script.js" data-api="/stats/collect"></script>

  3. Step 3: Test with an ad blocker

    Open your site with an ad blocker on. In your browser's Network tab, both requests should go to your domain and succeed.

  4. Done: Visitors with ad blockers are now tracked

    Pageviews show up on your dashboard as before, with the right country for each visitor.