Website Building » WooCommerce » How Do I Link Google Analytics to WooCommerce?

How Do I Link Google Analytics to WooCommerce?

Last updated on January 23, 2023 @ 3:53 pm

To link Google Analytics to WooCommerce, firstly, you need to have a Google Analytics account. If you don’t have one, you can create one here.

Once you have an account, login and click on the Admin tab. In the Property column, click on + New Property and select Website.

Enter a name for your website and the URL. Make sure that the “Website” radio button is selected and click on the “Continue” button.

On the next page, select the “Global Site Tag (gtag.js)” tracking option and click on the “Create” button.

PRO TIP: Google Analytics is a powerful tool that can help you track and analyze your website traffic. However, if you are not careful, it can also be used to collect sensitive information about your customers. For example, if you link Google Analytics to WooCommerce, it can collect data such as customer names, addresses, and credit card numbers.

To protect your customers’ privacy, only link Google Analytics to WooCommerce if you have a strong understanding of how the tool works and are confident that you can properly configure it.

You will be given a tracking code which you need to copy and paste into the header of your website. The code will look something like this:

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

gtag('config', 'UA-XXXXXXXX-X');
</script>

Once you have copied the code, login to your WordPress website and go to Appearance > Editor. Select the header.php file from the right hand side and paste the code into it just before the </head> tag. Save your changes and exit the editor.

Your Google Analytics account is now linked to your WooCommerce store!

Dale Leydon

Dale Leydon

Sysadmin turned Javascript developer. Owner of 20+ apps graveyard, and a couple of successful ones.