Skip to content
Free tool

tracking script blockermake tags wait for consent

Paste the tracking tags from your site. We recognise them, sort them into categories, and rewrite them so they only run after the visitor says yes.

Your tracking tags

Scripts found

4/4 blocked
  • Google Analytics

    https://www.googletagmanager.com/gtag/js?id=G-ABC123XYZ

  • Google Analytics

    window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gta

  • Meta Pixel

    !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.app

  • Hotjar

    https://static.hotjar.com/c/hotjar-1234567.js?sv=6

Your banner tool

Blocked until consent

Replace the original tags with these.

<!-- Google tag (gtag.js) -->
<script type="text/plain" data-category="analytics" async src="https://www.googletagmanager.com/gtag/js?id=G-ABC123XYZ"></script>
<script type="text/plain" data-category="analytics">
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-ABC123XYZ');
</script>

<!-- Meta Pixel -->
<script type="text/plain" data-category="marketing">
  !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
  n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
  document,'script','https://connect.facebook.net/en_US/fbevents.js');
  fbq('init', '1234567890');
  fbq('track', 'PageView');
</script>

<!-- Hotjar -->
<script type="text/plain" data-category="analytics" src="https://static.hotjar.com/c/hotjar-1234567.js?sv=6" async></script>

Loader for your own banner

Runs a category's scripts once the visitor accepts it.

<!-- Own banner: run the blocked scripts of a category once it's accepted -->
<script>
  function enableCategory(category) {
    document.querySelectorAll('script[type="text/plain"][data-category="' + category + '"]').forEach(function (blocked) {
      var s = document.createElement('script');
      for (var i = 0; i < blocked.attributes.length; i++) {
        var a = blocked.attributes[i];
        if (a.name !== 'type' && a.name !== 'data-category') s.setAttribute(a.name, a.value);
      }
      s.text = blocked.text;
      blocked.replaceWith(s);
    });
  }
  // From your banner: enableCategory('analytics'); enableCategory('marketing');
</script>

questionsand short answers

Why block scripts before consent?
Under ePrivacy Art. 5(3), analytics and advertising cookies may only be set after the visitor agrees. A banner that only hides itself while the tags already ran is the most common violation regulators find.
How does the blocking work?
The script's type becomes text/plain, so the browser doesn't run it. Your banner tool (or the small loader for your own banner) turns it back into a real script once the visitor accepts that category.
Is my code sent anywhere?
No. The rewriting happens in your browser; nothing you paste leaves the page.
What about Google Tag Manager?
Leave the GTM container itself unblocked and gate the tags inside it, with Consent Mode or GTM's built-in consent settings. Blocking the whole container also blocks tags that don't need consent.
Does it handle pixels in <noscript> or iframes?
No — only <script> tags. Remove <noscript> tracking pixels (they can't wait for consent) and load video embeds through your banner tool's placeholder feature.

see what your site really doesfree scan, about two minutes