Web page freeze due to Exchange script in GTM

Issue description

The web page does not load or freezes after adding the Acoustic Exchange Enablement key in the Google Tag Manager (GTM) tag.

Resolution

Make the following changes to your Acoustic Exchange Enablement Code.

  1. Open your GTM tag and go to the location where you had added the Exchange Enablement scripts.
  2. Comment out the Exchange Enablement scripts, as shown in the following example:
<!--<script type="text/javascript" src="//lib-us-3.brilliantcollector.com/common/ubxCapture.js">
  </script>
   <script> ubxCapture.setTenantID("WRTP",channelID);</script>
   <script type="text/javascript">ubxCapture.setID("4a7d5bda-b5d4-4cd4-ad10-d18df45f976f");
    </script>-->
  1. After you have commented out the scripts, add the following code snippet.
<script> 
    var url = '//lib-us-3.brilliantcollector.com/common/ubxCapture.js';
    var captureId = “<<CaptureID>>";
    var ubxScript = document.createElement("script")
    ubxScript.type = "text/javascript";
    if(ubxScript.readyState) {  // only required for IE <9
    ubxScript.onreadystatechange = function() {
       if ( ubxScript.readyState === "loaded" || ubxScript.readyState === "complete" )
       {
       ubxScript.onreadystatechange = null;
       setCaptureId();
            }
     };
    } else {  //Others
    ubxScript.onload = function() {
        setCaptureId();
      };
    }
      ubxScript.src = url;
      document.getElementsByTagName("head")[0].appendChild(ubxScript);
      function setCaptureId(){
        var s1 = document.createElement('script');
        s1.innerHTML =  'ubxCapture.setTenantID("WRTP",<<channelID>>);';
        document.head.appendChild(s1);
        var s2 = document.createElement('script');
        s2.innerHTML =  'ubxCapture.setID("<<captureId>>");';
        document.head.appendChild(s2);
     }
  </script>

In the code snippet:

  • Replace CAPTUREID with the CaptureID shown in your Enablement script.
  • Replace CHANNELTENANTID with the channel tenant ID.
  1. Next, save the GTM tag and publish the updates.
  2. Verify that your web page loads properly and does not freeze.