Cookie-Free Insider Tag Integration
  • 06 May 2024
  • 4 Minutes to read

    Cookie-Free Insider Tag Integration


      Article Summary

      Thanks to Cookieless World, you are able to show your campaigns to all your visitors regardless of their cookie acceptance status. To enable this flexibility, Insider has two different flows which are Cookie-free Insider Tag and Insider Tag (ins.js).

      If you want to integrate Cookie-Free Insider Tag, you can reach out to Insider team. Once the Cookie-Free Insider Tag is enabled, you will see the badge turned to “Enabled” state.

      Your title goes here
      Cookie-Free Insider Tag requires a different integration. Therefore, if you are an existing customer, you need to update your current integration, and if you are a new customer, you need to follow the steps listed on this page if you want to use Cookie-Free Insider Tag.

      Types of Integration

      You can integrate Insider Tag into your website in different ways. The main logic is that the insertion must happen following this algorithm:

      if (cookies_accepted) {
          load Insider Tag
      } else {
          load Cookie-Free Insider Tag
      }

      The condition inside "if" varies according to the partner.

      Insider Tag code must be as follows:

      1. Defining insiderFlow variable globally and making it equal to 3: 

      window.insiderFlow = 3;

      2. Integrating script from the following source:

      YOURPARTNERNAME.api.useinsider.com/ins.js?id=YOURPARTNERID

      Declare it under Marketing Cookies in your Cookie Bot (if you use any similar structure).

      Cookie-Free Insider Tag code must be as follows:

      1. Defining insiderFlow variable globally and making it equal to 1: 

      window.insiderFlow = 1;

      2. Integrating script from the following source:

      YOURPARTNERNAME.api.useinsider.com/ins.js?c=0

      Declare it under Essential Cookies in your Cookie Bot (if you use any similar structure).

      You can do all of these either in HTML or JavaScript depending on your preference. For Google Tag Manager (GTM), you need to use HTML.

      Custom way

      This can be applied via GTM, or hard-coded values in the website codes. You can check the condition here via the code snippet below:

      Drupal.eu_cookie_compliance.getCurrentStatus()

      It returns a value if the cookies are accepted, and an empty string if not. For any other custom way of implementation, the condition can be a cookie or a global variable depending on your cookie consent integration.

      CookieBot and GTM

      The CookieBot working with GTM fires a few events depending on the value of consent selected. When a marketing option, or all is selected, the cookie_consent_marketing event is triggered. The consent information is stored under CookieConsent.consented variable. 

      • For the Insider Tag follow the steps below:

      1. On your GTM account, add the script as HTML and choose Once per event option in the firing options.

      2. Select Custom Event for triggering and type cookie_consent_marketing as a value and save it. 

      • For Cookie-Free Insider Tag, which can be loaded anywhere where marketing cookies are not selected, follow the steps below:

      1. Add the script as HTML and choose Once per page option in firing options.

      2. Select Custom Event for trigger and type gtm.load as the event name. Note that this event is triggered after the CookieBot banner so that it can be used here. 

      3. Select New Variable in the Event field. Then, select JavaScript Variable from Page Variables.

      4. Type CookieConsent.consented as the variable name and save it. Then, choose equals from the dropdown menu and type false as the condition.

      5. Save and publish it.

      When CookieBot is integrated via GTM, and the user withdraws their consent, the event takes place on the page reload. So, when a user accepts cookies (Insider Tag is loaded), and then withdraws their consent on the same page, the Cookie-Free Insider Tag will not be loaded, but it will be loaded on the next page reload.

      OneTrust

      OneTrust stores the groups of your cookies under the window.OnetrustActiveGroups variable and its outcome may vary. The implementation must be as follows:

      Integration via JS code on your website

      var source = 'partnerName.api.useinsider.com/ins.js?c=0'
      
      window.insiderFlow = 1;
      
      if (window.OnetrustActiveGroups.includes('YOUR_CONSENT_ID_HERE')) {
          window.insiderFlow = 3;
          source = 'partnerName.api.useinsider.com/ins.js;
      }
      
      var _s = document.createElement('script');
      
      _s.setAttribute('src', source);
      
      document.head.appendChild(_s); // head or body

      Integration via GTM

      Alternatively, if you are integrating ins.js via Google Tag Manager (GTM), you can do it by triggering a tagon a custom event called OneTrustGroupsUpdated.

      1. Add Insider code as a Tag via Custom HTML option.

      2. Select Custom Event for the Trigger type.

      3. Type OneTrustGroupsUpdated as the event name, select Some Custom Events for firing options.

      4. Select New Variable in the Event field.

      5. Select JavaScript Variable from Variable types

      6. Type OnetrustActiveGroups as the variable name and save it.7. Choose the contains option from the dropdown and write your consent IDs.

      8. Apply the same for Insider Tag with consent IDs for marketing or all cookies, save and publish.

      BayCloud

      If you are using BayCloud, you can import ins.js with the following check:

      Integration via JS Code on your website

      var source = 'YourPartnerName.api.useinsider.com/ins.js?c=0'
      
      window.insiderFlow = 1;
      
      if (__cqheldcStatus.agreed === 'all') {
          window.insiderFlow = 3;
          source = 'YourPartnerName.api.useinsider.com/ins.js;
      }
      
      var _s = document.createElement('script');
      
      _s.setAttribute('src', source);
      
      document.body.appendChild(_s);

      Wix

      If you are using Wix to serve your website, it’s better to check the policy from the cookie since the Wix’s cookie bar is loaded after the Essential codes.

      • Cookies are stored in the browser, so there’s no need to wait for any function and the following code can be applied to load Cookie Free Tag:
      <script>
      (() => {
      const getCookie = (e) => {
          let t, n, o = '[;\\s ]?' + e + '=([\\S]+(?:;?))';
          return (null === (n = null === (t = document.cookie.match(o)) || void 0 === t ? void 0 : t.pop()) || void 0 === n ? void 0 : n.replace(';', '')) || void 0;
      }
      
      const r = JSON.parse(decodeURIComponent(getCookie('consent-policy') || 'false'));
      
      if (r || r.anl || r.adv) { return; }
      
      window.insiderFlow = 1;
      
      const s = document.createElement('script');
      s.setAttribute('src', 'https://YourPartnerName.api.useinsider.com/ins.js?c=0');
      document.head.appendChild(s);
      })();
      </script>

      This code checks the existence of the cookie:

      • If the cookie is not present - no consent interaction was made, the code loads Cookie-Free Tag.
      • If the cookie is present and the values do not include analytical or marketing ones, the code loads Cookie-Free Tag.
      • The code does nothing in other cases since other cases are covered with Marketing Code Types.



      Was this article helpful?


      ESC

      Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses