Playing Field: Check for jQuery dependency

jQuery is loaded from the Google CDN at the very bottom of this page. If you have tags that depends on the presence of jQuery, you could delay them until event = gtm.dom, but this would delay tags unncessarily if jQuery is available faster.

Instead, use a timer listener, a macro and a rule based on this macro.

  1. Create a macro named {{time id}} of type DataLayer Variable Name for "gtm.timeId"
  2. Create a macro named {{jquery}} of type Custom Javascript with
    function () {
       if(jQuery)
          clearTimeout({{timer id}});
       return typeof jQuery;
    }
  3. Create a Timer Listener with timer name: jquery.timer, interval: 250
  4. Any tag that needs to be fired once jQuery is loaded would have a rule of {{jquery}} = function

Copyright Cardinal Path © 2014, All Rights Reserved. Privacy and Copyright Policies.