1. 4
  1. 4

    I expected this <opt-in-script> tag to be defined as a custom element but it’s just ignored by the browser and rendered as a p while there is some JS to turn it into a <script> tag on the button click. It’s actually a quite nice implementation that can be used for older browsers.

    1. 2

      Yeah. No need for anything fancy, the script is less than 500 bytes. IIRC unregistered custom tags used to cause issues in IE8. After that they’ve been handled as unstyled inline elements.

    2. 3

      I’ve thought about opt-in analytics before: I’d like to have analytics on my site, but I don’t want to track my visitors without consent or give their data to third parties. The solution might be a please track my visit button.

      Is this not exactly what the Do Not Track header is for? It can also be checked with a Javascript attribute.

      1. 2

        That’s a very good question. It never crossed my mind.

        I’d think that most people would oppose tracking them if they knew what it is, so the absence of DNT might rather mean ignorance than opting in to tracking.

        But I will certainly think about this. Thanks!

        EDIT: Looking at the spec, DNT: 0 indeed indicates that the user has opted in to tracking (while the absence means nothing). I’ll probably see if any visitors have that turned on later. :)

      2. 2

        Have a look at Offen, this might be what you are after.