Set up Google Analytics in Magento 2

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:

  • Step 1: Obtain a tracking ID
  • Step 2: Configure the Google API in Magento 2

Step 1: Obtain a tracking ID

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

magento19.png

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

magento19.png

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

magento19.png

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

magento19.png

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

Step 2: Configure the Google API in Magento 2

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

magento19.png

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.

magento19.png

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.