Tracking tag for websites that use Cookie Yes

If you are using Cookie Yes for your Cookie management on your website, you may require some customisation to our default JavaScript to avoid issues with your attribution and tracking.

🚧

We recommend using a 'full screen' cookie consent banner with Cookie Yes

Cookie Yes can block the creation of analytics cookies until the user consents. This means analytics solutions can't track users if they don't interact with the cookie consent banner when they arrive on the website.

For information on customising your cookie consent banner, visit Cookie Yes.

If your website uses Cookie Yes to manage cookie consent, please use this version of the Ruler tracking script.

❗️

Replace your Site ID

Please replace INSERT YOUR SITE ID HERE on line four of the code below with the Ruler Site ID for your tracking site.

Your unique Site ID can be found in your dashboard here

<script>
  function initializeRulerTracking() {
    window.__raconfig = window.__raconfig || {};
    window.__raconfig.uid = "INSERT YOUR SITE ID HERE";
    window.__raconfig.action = "track";

    (function () {
      var ra = document.createElement("script");
      ra.type = "text/javascript";
      ra.src = "https://ruler.nyltx.com/lib/1.0/ra-bootstrap.min.js";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(ra, s);
    })();
  }

  function handleConsentUpdate(eventData) {
    var data = eventData.detail;
    if (data.accepted.includes("analytics")) {
      initializeRulerTracking();
    }
  }

  document.addEventListener('cookieyes_banner_load', function(eventData) {
    var data = eventData.detail;
    if (data.categories.analytics) {
      initializeRulerTracking();
    } else {
      document.addEventListener('cookieyes_consent_update', handleConsentUpdate);
    }
  });
</script>

This script should be applied to 'all pages' where Cookie Yes is enabled.

If you are implementing your Ruler tag via Google Tag Manager, you can apply this script as Custom HTML tag. The trigger will need to be a custom trigger set up specifically to work with Cookie Yes. Instructions on setting this up can be found on Cookie Yes. custom Cookie Yes event triggers in Google Tag Manager.


For more information or support please email [email protected]