Support » Plugin: Head Cleaner » Syntax error in Google Tag Manager script

  • Head Cleaner converts quotes in Google Tag Manager script and it causes syntax error. Here is the optimized code by Head Cleaner. See line 3, after gtm.js?id=.

    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id="+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,"script','dataLayer','GTM-XXXX');

    You can see the original JavaScript at https://developers.google.com/tag-manager/quickstart

    And I’m using TwentySixteen theme and head cleaner with default settings. Only “Add canonical tag.” is enabled. How can I solve this issue?

  • The topic ‘Syntax error in Google Tag Manager script’ is closed to new replies.