Add Google Analytics Script to Vend E-Commerce


Latest update: - Jack Harrison-Sherlock

Adding the following code (known as the "JavaScript tracking snippet") to your site's templates is the easiest way to get started using Google Analytics. To do so, follow the steps below:

1. The tracking code can be added into your theme by going to Vend Ecommerce -> Design.

2. Click on the theme name you want to add the code into.

3. Click on Edit HTML/CSS and locate theme.liquid.

4. In the theme.liquid file paste the tracking script/code between the <head> </head> elements. 

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

5. You will need to replace the UA-XXXXX-Y with your property ID (also called the "tracking ID") of the Google Analytics property you wish to track.

Tip: If you do not know your property ID, you can use the Account Explorer on Google to find it.

6. Click Save and you will now have Google Analytics included.


Powered by Zendesk