This article will guide you on how to add your Google Analytics code to enable Google Analytics tracking.
- In your admin area, navigate to Store Settings > Analytics.
- Under Google Analytics, you'll see your store name. Click on the edit icon to the right of your store name.
- Add the whole global site tag in the text box and not only the UA numbers.
- Set the Status to Enabled.
- Navigate to your Google Analytics dashboard and verify if your site is being tracked. It might take some time before data shows up. Consult Google's documentation to find out how long.
Here's an example of a global site tag code (make sure not to use this one as this is a sample):
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-1"></script>
window.dataLayer = window.dataLayer || ;
gtag('js', new Date());