Adding products is not enough for a successful online business. You need to understand your audience. This is where Google Analytics comes in handy. It is a tool that will help you track users engagement on every page of your store.
How to Add Google Analytics In Magento 2 Stores
We have broken down this article into different subheads that will help you to add Google Analytics in Magento.
- Create a Google Analytics Account
- Get Tracking Code
- Configure API in Magento 2
- Enable eCommerce Tracking
- Check if the Code is Working Properly
Note: If you are still you using Magento 1, we highly recommend you to migrate from Magento 1 to Magento 2.
1. Create a Google Analytics Account
To start with the process, you will have to create an account on Google Analytics.
1.1 Go to their official site. Fill in your Gmail address and password.
1.2 If you don’t have an account. Here’s how to create one:
- Click on “Create Account“. Fill in the required information.
- Read the Privacy and Terms carefully and click on “I Agree“.
1.3 Once you have created your Gmail account you will be redirected to Google Analytics.
1.4 Click on “Sign Up” to start using Google Analytics.
1.5 Carefully fill in all the details about your website. Enter your account and website name, website URL, industry category, and reporting time zone.
1.6 Click on “Get Tracking ID” button.
Note: Before starting to fill the information make sure you have selected “Website” on top.
2. Get Tracking Code
On your Google Analytics dashboard, you will see a gear icon on the bottom left corner. This is called an Admin tab.
2.1 Click on Admin tab > Tracking Info > Tracking Code.
2.2 Copy this tracking ID. You will have to paste this to your Magento backend.
3. Add Google Analytics in Magento Panel
3.1 Login to your admin panel.
3.2 Click on Stores > Configuration from the left sidebar.
3.3 In Sales panel, click on Google API.
3.4 In the field provided for Account Number, enter your Tracking ID.
3.5 Also, if you wish to render as anonymous part of your visitors’ IP addresses, set Anonymize IP to “Yes.”
3.6 Click on “Save Config” button on the top right corner.
Note: It might take up to 24 hours before your data gets tracked on Google Analytics.
4. Enable eCommerce Tracking
This is an important step. Make sure you have enabled e-commerce tracking in Google Analytics.
4.1 In your Google Analytics Dashboard, go to Admin.
4.2 Under all website data, click on eCommerce settings.
4.3 You will see an on-off button. Click on the button to enable eCommerce and enhanced eCommerce reporting.
4.5 Click on “Save”
You have complete adding your Google Analytics in Magento store.
5. Check if the Code is Working Properly
To check whether the tracking code is working, simply go to your store frontend and then in another tab, open Google Analytics.
Click on Real-time > Overview.
If you see one active user right now that means you have successfully integrated Google Analytics in Magento 2.
6. Reasons why your tracking code isn’t working
If in case you don’t see any active users, don’t panic. Look for following pointers to make sure there aren’t any mistakes:
6.1 Cross Check your Analytics Code
If you are copying and pasting the code from a doc file, there is a chance you might break the code. Always copy and paste the code directly from Google Analytics account. Also, make sure there aren’t any extra spaces between the letters.
6.2 Check for Google Analytics Filters
In your Analytics account go to Admin > Filters. Review all the filters you have added to your account. There may be a chance that you have excluded your IP address tracking. As a result, you won’t see any real time users from your IP address.
Also, if you have added multiple “Include” filters, that might also affect your tracking data.
6.3 Google Penalties
Google penalties are very common these days. Since you have an eCommerce site, you need to keep a look out for these. If you aren’t using SSL or you have some suspicious content on your website, Google will penalize your site. As a result, you will see a huge drop in traffic which might be confused with Google Analytics not tracking your traffic.
Google Analytics is a free service that will prove very useful for your eCommerce website. All you need to do is create an account on Google Analytics and paste the tracking code in your Magento panel.
Once you start getting traffic on your website, record and analyze to better optimize your website experience.
Also, since you are going to track and store users data be sure to make your Magento GDPR complaint.
If you face any problem with your Google Analytics account, you can always contact our Magento experts.
Services we offer:
- Managed Magento Hosting for Businesses
- Managed WordPress Hosting for Business-Agency
- AWS Management
- DigitalOcean Managed
- Managed Cloud Server India
- Dedicated Server India
Enquire now and join 1000+ businesses who have blitzscaled their websites by choosing ServerGuy as their hosting partner.