Rename the data layer

By default, the data layer initiated and referenced by the global site tag is named dataLayer. To use a different name:

  • Update all instances of "dataLayer" in the global site tag to the new name (e.g.: gDataLayer)
  • Add an "l" query string parameter to the URL and reference the same new data layer name.
<!-- Global site tag (gtag.js) -->
<script async src=""></script>
  window.gDataLayer = window.gDataLayer || [];
  function gtag(){gDataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA_MEASUREMENT_ID');