'no longer working gtag due to ERR_ABORTED 404 (gclidless)

GET https://www.gstatic.com/conversions/gclidless.js net::ERR_ABORTED 404

I got this error, so I was wondering what was wrong, and checked GTM and found this:

<script async src="https://gstatic.com/conversions/gclidless.js"></script>
  
<script>
(function ($) {

  var getParam = function (p) {
    var match = new RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search);
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
  };

  function getExpiryRecord(value)
  {
    var expiryPeriod = 90 * 24 * 60 * 60 * 1000; // 90 day expiry in milliseconds

    var expiryDate = new Date().getTime() + expiryPeriod;
    return {
      value: value,
      expiryDate: expiryDate
    };
  }

  var addGclid = function ()
  {
    var gclidFormFields = ['input[name=gclid_field]']; // all possible gclid form field ids here
    var gclidParam = getParam('gclid');
    var gclidRecord = null;

    var gclsrcParam = getParam('gclsrc');
    var isGclsrcValid = !gclsrcParam || gclsrcParam.indexOf('aw') !== -1;

    if (gclidParam && isGclsrcValid) {
      gclidRecord = getExpiryRecord(gclidParam);
      localStorage.setItem('gclid', JSON.stringify(gclidRecord));
    }

    var gclid = gclidRecord || JSON.parse(localStorage.getItem('gclid'));
    var isGclidValid = gclid && new Date().getTime() < gclid.expiryDate;

    if (isGclidValid) {
      $('input[name=gclid_field]').val(gclid.value);
    }
  }

  $(document).ready(function () {
    $('form').prepend('<input type="hidden" name="gclid_field" style="display: none;" data-added-by="tagmanager.google-add-gclid">');
  });

  $(document).ready(function() {
    window.setUpGclidless();
    
    $(document).on('submit-success', 'form', function(event, postdata) { 
      window.sendData([ postdata['email'] ]); 
    });
  });
  
  $(document).ready(addGclid);

})(jQuery);
</script>

I got on my hands this google tag, but the problem is that it's no longer working, and I am wondering if there's a newer version of this tag I should replace. Maybe replacing the URL will work, because https://gstatic.com/conversions/gclidless.js leads to a 404.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source