Integrating Google Analytics in Magento 2

Updated on Mar 13, 2019

Being able to track the traffic on your Magento 2 website will enable you to better manage the products on your store and have more customers. Google Analytics has you covered when it comes to traffic tracking.

To enable Google Analytics in Magento 2 you will need to:


Obtain a tracking ID

To obtain this tracking ID you have to create an account with Google Analytics.

Signing in to Google Analytics

Select the Sign in with Google Analytics option and click Sign up.

Sign up with Google Analytics

Fill the account details and scroll to the bottom of the page to click on the Get Tracking ID button.

Obtaining a Tracking ID

Now you will have to accept the Google Analytics Terms of Service, if you read and agreed with them.

Accepting the Google Analytics Terms of Service

You will now have to copy the tracking ID in preparation for the next step.


Configure the Google API in Magento 2

Login to your Magento 2 admin area and navigate to Stores → Configuration.

Access the Sales>Google API section, expand the Google Analytics option, Enable it and paste the tracking code in the Account Number field. Also click on the Save Config button to apply the changes.

Configuring the Google API in Magento 2

Wait a few minutes for the traffic data to load in your Google Analytics dashboard and you will be able to track the activity on your website.

On this page...

    Magento 2 Hosting

    • Free Installation
    • 24/7 Magento Support
    • Free Domain Transfer
    • Hack-free Protection
    • Fast SSD Storage
    • Free Cloudflare CDN
    • Free Magento Transfer
    • Immediate Activation
    View More