title: Error in Google Tag Manager: this language feature is only supported for ECMASCRIPT6 mode or better
body: <p>I'm getting the following error message in Google Tag Manager:</p>
  <blockquote>
  <p>Erro na linha 3, caractere 13: This language feature is only supported for ECMASCRIPT6 mode or better: const declaration.</p>
  </blockquote>
  <blockquote>
  <p>Erro na linha 3, caractere 32: This language feature is only supported for ECMASCRIPT6 mode or better: arrow function.</p>
  </blockquote>
  <p>when adding this HTML snippet tag</p>
  <pre><code>&lt;script&gt;
      window.addEventListener(&quot;load&quot;, function () {
          const URLToArray = url =&gt; {
              var request = {};
              var pairs = url.substring(url.indexOf('?') + 1).split('&amp;');
              for (var i = 0; i &lt; pairs.length; i++) {
                  if (!pairs[i])
                      continue;a
                  var pair = pairs[i].split('=');
                  request[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
              }
              return request;
          }
          $(document).on(&quot;submit&quot;, &quot;form&quot;, function (ev) {
              var params = URLToArray(window.location.href)
              if (params) {
                  $('&lt;input&gt;').attr({
                      type: 'hidden',
                      name: 'field[2]',
                      value: params['utm_source']
                  }).appendTo($(this));
  
                  $('&lt;input&gt;').attr({
                      type: 'hidden',
                      name: 'field[3]',
                      value: params['utm_medium']
                  }).appendTo($(this));
  
                  $('&lt;input&gt;').attr({
                      type: 'hidden',
                      name: 'field[4]',
                      value: params['utm_campaign']
                  }).appendTo($(this));
  
          $('&lt;input&gt;').attr({
                      type: 'hidden',
                      name: 'field[5]',
                      value: params['utm_term']
                  }).appendTo($(this));                   
                  
                  $('&lt;input&gt;').attr({
                      type: 'hidden',
                      name: 'field[6]',
                      value: params['utm_content']
                  }).appendTo($(this));
                  
              }
          })
      })
  </code></pre>