Adding Google Analytics tracking to OpenCart 1.5.x & 2.x

For any business, it's important to understand exactly how your audience is finding you. With Google Analytics, you can accurately track everything from your visitors' country and language to the success rate of individual pages - and even better, it's all completely free.

Before you can start collecting data about your customers, you'll need to add your Google Analytics code to your OpenCart store. This is really easy to do, no matter which version of OpenCart you're using.

​Get your Google Analytics code

To find your Google Analytics code, simply log into your Google Analytics account and go to the Admin tab. Make sure you're viewing the correct account and property - you can select these using the drop down menus. Under Tracking Info > Tracking Code, you'll be able to view and copy the tracking code for your site.

Analytics Tracking Code

The location where you enter your tracking code in your OpenCart admin area varies slightly depending on which version of OpenCart you're using. Below, we've outlined how to quickly and easily add your tracking code to OpenCart 1.5.x to 2.0.x, and OpenCart 2.1.x to 2.3.x.

​Adding the Google Analytics tracking code in OpenCart 1.5.x to OpenCart 2.0.x

Log in to your admin area and go to System > Settings. This lists all of the stores that are enabled on your site - unfortunately, in these versions of OpenCart you can only use one Google Analytics code for every store. Click edit on your main store and click the Server tab. At the bottom, there will be a large text field where you can paste your Google Analytics code which we copied earlier.

Analytics in OpenCart
Add Analytics Code in OpenCart

​Adding the Google Analytics tracking code in OpenCart 2.1.x to OpenCart 2.3.x

OpenCart 2.1 re-works the analytics feature bringing additional functionality such as different codes per store and the ability for 3rd party developers to create new Analytics modules.

To add your Google Analytics code, log in to your admin area and go to Extensions > Extension and choose Analytics from the drop down (OpenCart 2.1 / 2.2 users can go straight to Extensions > Analytics). Next, click the green + icon next to Google Analytics to install the module. This will add an extra row underneath for every store on your website.

Setting up Analytics Tracking in OpenCart
eCommerce Analytics OpenCart

Then, click edit on the store you want to add the Google Analytics code to and paste code into the large text field. Change the status to 'Enabled' and your Google Analytics code will being tracking data from your OpenCart store.

How to Add Analytics to OpenCart


Remember to paste the full code (including the < script > tags) into the field in your OpenCart admin area - not just the unique UA code - or the tracking code won't work.

​How to check it's tracking correctly

You'll immediately be able to see if your Google Analytics tracking code has been set up correctly by going to the Real Time section of your Google Analytics account. Simply visit your site (ensuring that you haven't set up any filters or restrictions to block your IP address) and check to see if you show up as a user in the Real Time section.

Check UTM Tracking in Analytics

​Need help?

If you're having trouble adding your Google Analytics tracking code to your OpenCart store or you'd like help setting up any tracking, our team are on hand to help. Just send us a message and we'll be able to do it for you.

Sign up!

Join the newsletter