Саша Черных
Саша Черных

Reputation: 2823

Block online tracking on site

1. Summary

I can't find how I can prevent online tracking on my site, if site visitors don't have any blocking tools.


2. Limitations

I have a static site. It would be nice if any solutions for JavaScript include JQuery and/or any other libraries; But not solutions for dynamic sites.


3. Details

I include to my site third-party frames, videos, widgets and so on, that can include analytics scripts. I don't want visitors of my site to be tracked. I want to block requests.

Visitors of my site can install some browser extension, that prevents online tracking. But users without browser extensions will be tracked.

Is it possible prevent analytics scripts for any modern browser, if the user doesn't have browser extensions or another method for blocking monitoring? If so, what can I do?


4. Example

Simply HTML file Sasha__JavaScript--BlockRequests.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="https://mc.yandex.ru/metrika/watch.js"></script>
    <script src="https://secure.quantserve.com/quant.js"></script>
    <script src="https://secure.gaug.es/track.js"></script>
</head>
<body>

</body>
</html>

I want it so that requests to any URL containing these domain names will be blocked (I use glob patterns in examples):

(In reality, I need to prevent online tracking also for some sites from this list)

It's possible, if visitor use Privacy Badger extension:

Privacy badger prevent tracking

Is it possible, if user doesn't have any extension?


5. Not helped

  1. I found an answer, how, possibly, I can disable own tracker. But I don't use any own analytics, all tracking scripts in my site include the third-party site elements.
  2. I found an answer, how, possibly, I can disable specific tracker. But:

    1. I can't find solutions for specific trackers
    2. It would be nice to have solution, that will not rely on the settings of a specific tracker
  3. I tried to read more about AJAX, AjaxQ, but I can't find how I can solve my problem.


6. Do not offer

  1. Please don't tell me, I shouldn't interfere with third-party monitoring. I don't approve of any tracking; see my opinion in article Why online tracking is bad.

Upvotes: 2

Views: 2670

Answers (1)

brass monkey
brass monkey

Reputation: 6771

I think you could achieve this by using a Content Security Policy header script-src in the responses which only whitelists the allowed domains. That way the tracking scripts should be blocked by the browser.

Upvotes: 2

Related Questions