How to Add Google Analytics to Magento 2 Store

by Fayyaz Khattak  February 6, 2017

Google Analytics (GA) is a free service by Google that allows you to monitor website traffic and conversion ratio in a few clicks. For managers who want to manage their websites actively, Analytics is a highly useful service. With GA, you can pay more attention to important ratios like sessions, traffic, region, tracking, and conversions.

Add Google Analytics to Magento 2

Many Magento store owners are not aware of the monitoring services that come built-in with Google Analytics. It can provide in-depth insights about store traffic, visitor segmentation, ecommerce conversions, demographics visualization, and goal related tracking. All these services can give a new dimension to your business.

Due to complex functions, adding Google Analytics to your Magento 2 store may seem like a daunting task. It can be frustrating, especially when you run into a problem or your store is not tracking the way you planned it to.

The most common challenges are also the most critical components for any Magento 2 store. For example:

  • Tracking Demographics
  • Ecommerce Statistics
  • Conversions

Configuring GA for all these components in a Magento 2 ecommerce store is a complicated task. To make it easier, you should follow these steps:

Get GA Tracking Code

  1. First of all, login to your Google Analytics account. If you don’t have one, just sign up for free and get started.
  2. Click the Admin on the top nav bar and from the ACCOUNT drop-down, click Create new Account.

Google Analytics Admin

  1. Enter the required information and click Get Tracking ID button at the bottom.

Get Tracking ID

  1. Accept the Terms of Service Agreement by clicking the I Accept

Terms And Conditions

  1. Once your account is setup, you will be directed to the Tracking Code Google Analytics Tracking Code is required to collect data on website’s behaviour and then send it to Google Analytics. Select and copy the Tracking Code as shown in below image:

GA Tracking Code

Add Google Analytics to Magento 2

  1. Log in to your Magento 2 admin panel and navigate to Stores > Configuration.

Magento 2 Store Configuration

  1. Expand the Sales section and click on Google API. Enable the Google API and paste the GA Tracking Code in the Account Number text field. Once done, hit the Save Config button to apply the new changes.

Magento 2 Google Analytics

Set up Ecommerce Tracking

  1. And now we are going to set up ecommerce tracking. The ecommerce reports by Google Analytics helps you to analyse the purchase activity on your Magento 2 store. You can see product/transaction information, average order value, ecommerce conversion rate, purchase time, and other data. To do so, go to the Admin area of your GA Accounts and tap on Ecommerce Settings.

GA Ecommerce Settings

  1. Now enable Ecommerce and turn on Enhanced Ecommerce Reporting. Lastly, click on Submit.

GA Ecommerce Reporting

Now visit your store and wait a few minutes for the traffic data to load in your GA and you will be able to track the activity on your Magento 2 store.

Google Analytics Magento 2 Tracking

Conclusion

You have successfully added Google Analytics to your Magento 2 store. Your GA is now ready to collect and track data, and it is also configured for advanced ecommerce reporting. You should now relax because Google Analytics will take care of it all now! The above method can help you utilise GA to maximise your sales, conversions, marketing, and SEO on your Magento 2 store through tracking your customer statistics. For additional queries or if you have any specific questions, please share them in the comments section below.

Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About Fayyaz Khattak

Fayyaz is a Magento Community Manager at Cloudways - A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. Fayyaz is a food lover and enjoys driving. You can email him at m.fayyaz@cloudways.com

Stay Connected:

You Might Also Like...