Install the global snippet

The global snippet must appear at the top of every page on your site. gtag() commands cannot send data unless a global snippet appears on the page, and that snippet appears above where any gtag() commands are called.

Each supported product generates tags that can be copied and pasted into web pages. To learn how to locate the snippet for a product, see the product- specific documentation: (Analytics, AdWords, DoubleClick Campaign Manager, DoubleClick Search).

Alternatively, you can construct your own snippet. Select the corresponding tab below, copy the snippet, and paste it immediately after the <head> tag on every page of your website. Replace the GA-TRACKING_ID, AW-CONVERSION_ID, and DC-FLOODLIGHT_ID placeholders with the appropriate IDs. You need only one global snippet per page.

Google Analytics

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA-TRACKING_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA-TRACKING_ID');
</script>

AdWords

<!-- Global site tag (gtag.js) - Google AdWords: CONVERSION_ID -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-CONVERSION_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments)};
  gtag('js', new Date());

  gtag('config', 'AW-CONVERSION_ID');
</script>

DoubleClick

<!-- Global site tag (gtag.js) - DoubleClick -->
<script async src="https://www.googletagmanager.com/gtag/js?id=DC-FLOODIGHT_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments)};
  gtag('js', new Date());

  gtag('config', 'DC-FLOODIGHT_ID');
</script>