railslove / rack-tracker

Tracking made easy: Don’t fool around with adding tracking and analytics partials to your app and concentrate on the things that matter.
https://www.railslove.com/open-source
MIT License
648 stars 121 forks source link

Respect Do Not Track (DNT) headers by default (breaking change for some users) #111

Closed bumi closed 6 years ago

bumi commented 6 years ago

The Do Not Track (DNT) header is the proposed HTTP header that requests that a web application disable its tracking of an individual user.

This changes the default to respect the DNT header and no longer injects any tracker if the DNT header is set to 1 (user opt-out). This behaviour can be overwritten by setting the DO_NOT_RESPECT_THE_USERS_CHOICE_TO_OPT_OUT option on handlers that should still be injected.

related: #98

bumi commented 6 years ago

@DonSchado I had an hour on the plan and tried to implement the change to respect the DNT header. What do you think? Can you review this carefully as it is a breaking change. Do I set the HTTP header correctly in the test? Do I test for the presence of the header correctly?

If we merge this we should also release it in v2 (breaking change).

bumi commented 6 years ago

@jhilden what are your thoughts? - As you also did a lot of analyics stuff...

jhilden commented 6 years ago

The general idea sounds good to me. :+1:

However, the wording DO_NOT_RESPECT_THE_USERS_CHOICE_TO_OPT_OUT sounds a little krass to me, though. What do you think about simply IGNORE_DO_NOT_TRACK_HEADER?

bumi commented 6 years ago

nice, good to hear.

regarding the wording... hmmm. actually I already toned it down from what I had before. :) I would like to indicate that it actually sucks and that the header is there for a reason and make the developer aware of that (assuming most trackers injected are there to track the individual user)

DonSchado commented 6 years ago

love it! 💚

@jhilden that wording was indeed on purpose ;)

bumi commented 6 years ago

faster than @tmschndr on the merge button :D hope you've reviewed it carefully? I think we should still put a bit more QA on it.