Set up the Analytics tag
- If you have not already done so, create a property in Google Analytics. Create one Analytics property for each website you want to collect data for. Creating a property generates a Google Analytics ID, which you'll use in your gtag.js installation.
- Find your Google Analytics ID, as described below. You'll use this Google Analytics ID in your setup.
- Copy and paste the global site tag to each web page you want to measure. Add the tag right after the opening
<head>tag on each page.
Find your Google Analytics ID
To find the Google Analytics ID:
- Sign in to your Analytics account.
- Click Admin.
- Select an account from the menu in the ACCOUNT column.
- Select a property from the menu in the PROPERTY column.
- Under PROPERTY, click Tracking Info > Tracking Code. Your Google Analytics ID is displayed at the top of the page.
The global site tag
Paste the tag right after the
<head> tag on each page of your site. Replace
GA_MEASUREMENT_ID with your own Google Analytics Google Analytics ID:
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
window.dataLayer = window.dataLayer || ;
gtag('js', new Date());
Verify that the tag is working
To verify that the tag is working, visit your website and check to see that your visit is being registered in the Real-Time reports.