How to Install Google Analytics tracking code in Magento

0

As you know, Google analytics is a great tool to track and analyze traffic to your website. Installing Google Analytics code may be a little tricky for new Magento users. In this tutorial for beginner, we will learn how to install Google analytics tracking code to a Magento website.

Step 1: Get Analytics Account Number

First, you will need to register for a Google analytics account at http://www.google.com/analytics/sign_up.html

how to install google analytics code to magento

Once you get the account, go to https://analytics.google.com/ for google analytics dashboard. After adding your website to Google Analytics, we will need to find Account Number (ID). Navigate to Admin > User Management > Tracking info > Tracking code section, you will see your Account number here

how to install google analytics code to magento 2

Step 2: Insert account ID to Magento

After getting Account ID, we will use this ID in Magento to enable tracking. In your Magento backend, go to System > Configuration > Sales > Google API

google api magento

Now, select Yes in Enable field, enter the code we obtain at step 1 and save changes

how to install google analytics code to magento 4

Now the Google Analytics tracking code is added to your website

Step 3: Check if the code is installed properly

Open your Magento site homepage and Inspect its code (shortcut F12).

check installation of google analytics for magento

Scroll down you will see a code like this installed to your site

You can see the line:  ga('create', 'UA-85961389-1', 'auto'); with your Analytics Account ID inside.

Hope you enjoy this quick Magento tutorial, feel free to let me know if you have any questions.

How to Install Google Analytics tracking code in Magento
5 (100%) 1 vote

Share.

About Author

Daniel is a Magento developer with 5 years of experience with customizing Magento extensions, Magento templates. He's main author at Magento explorer

Leave A Reply