How to add Google Analytics to a WordPress eCommerce store?

Analyzing your site’s data is essential in creating an effective marketing strategy and optimizing your website to increase the conversion rate. The most popular traffic analysis tool is Google Analytics, which provides all the crucial data regarding the customers and their interactions with your website. In this article, we will explain the significance of Google Analytics and how to add it to a WordPress site.

Google Analytics

As we mentioned in the introduction, the primary purpose of Google Analytics is to track users’ activities on your website. In particular, the service can show the data about the visitors, their age, country, where they come from to your website, how much time they spend on each page, and where they bounce. With this information, a site owner can identify the patterns and behavior of visitors and make decisions that would improve the performance of each aspect. Moreover, Google Analytics can provide specific suggestions that would improve the conversion rate. Basically, using Google Analytics is a crucial way to always have information about how you can optimize your website to be better and in what areas you need to make changes.

How to add Google Analytics to a WordPress site

Initially, to connect your website with Google Analytics, you need to create an account there. After filling in all the information about your website and the purpose of data analysis, you will get a tracking code that has to be added to a WordPress site via one of the methods. However, you don’t need to know how to code or perform complicated programming manipulations. You can connect your website to Google Analytics with these three methods:

Google Analytics Plugin

Multiple plugins for WordPress allow connecting your site to Google Analytics and accessing the statistics dashboard right from the WP admin panel. For instance, a popular plugin MonsterInsights allows adding Google Analytics easily. You just need to choose this plugin from the side panel, click sign in with Google Account, and choose your account where Google Analytics is connected. Although there are paid plans for MonsterInsights to receive detailed data, this method is the most convenient one because it connects Google Analytics by itself and shows all the crucial data from the WordPress admin panel.

MonsterInsights Dashboard. 

However, when your WP site is overwhelmed with the heavy plugins that actively collect data might slow down the performance. In this case, you can use True Lazy Analytics, which uses lazy loading that does not affect a site’s speed. And it is also easy to use: you just need to enter a tracking number, and the plugin will do the rest.

Another similar to installing plugins method to add Google Analytics is to install a header and footer plugin. And then, from the Google Analytics page, you can add a piece of code that is used for tracking your website. To find the tracking code, visit the homepage of Google Analytics and click on Admin.

  • Then, click on the Tracking Info menu and choose the Tracking Code
  • After that, you will get your unique tracking code under this section:
  • Copy the tracking code and paste it into a header or footer.
    Now, you can track the data of your website. However, this method allows you to browse and check the statistics only from the Google Analytics Admin panel rather than from WordPress directly.

Adding code to a theme

This method is more advanced, but it is the purest solution without using additional plugins. One has to know how to add code snippets into WordPress themes. Nevertheless, the steps are following:

  • Find and edit header.php file.
  • Copy the tracking code from the Google Analytics admin panel (instructions in the second method above) and paste it after the <body> tag.
  • Save changes and upload this file.

Even though this method might be complicated for a merchant without technical experience, this is a straightforward task for a developer. After completing this step, you can track your website’s data from the Google Analytics dashboard. 


Considering that connecting Google Analytics to your WordPress website is not that difficult and there are multiple ways to do it, one can agree that it is one of the first things to do when setting up an eCommerce store. In addition, with the variety of plugins that show detailed statistics from the WordPress dashboard, every merchant can optimize their marketing strategy conveniently from one place.

Related Articles

Notify of
Inline Feedbacks
View all comments