yett – A small webpage library to control the execution of (third party) scripts like analytics

In order to provide GDPR compliant consent-first-analytics (and other stuff), you can use yett:

Blocking execution of analytics script (until consent is given) can be done manually, but the problem is that analytics providers often provide minified code embeds that you have to include in your html as they are. If you want to exercise control over their execution, then you have to tamper with this minified JS yourself, which is complex and does not scale well if you load server 3rd party scripts.

Thus we invented yett. Just drop in the script and define a domain blacklist – yett will take care of the rest ✨.

Uses MutationObserver under the hood, thus is compatible with even IE11.

Beware though, as this might conflict with applications that rely heavily on document.createElement (like React):

This library monkey patches document.createElement. No way around this.

yett – Control the execution of (third party) scripts like analytics →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.