Setting Up Google Analytics for Magento

Regardless of the purpose of having your own website, your first thing should be to attract visitors and hope they will convert into paying customers in the future. Google Analytics 4 is a perfect free option from google to help you collect analytics information about your website traffic.

1. Create Your Google Analytics Account

To set up your GA (Google Analytics) account, you’ll first need to log in to your Google account. If you don’t yet have a Google account, you will need to create one.

Once you are signed in to your Google Account, redirect to the Google Analytics account creation page and click “Start measuring” button.

Welcome to Google Analytics

You will be taken to the account creation page where you will be asked to complete information entries.

Account setup

Google Analytics Account setup

Provide your company name then click “next”

Property setup

Google Analytics Property setup

Enter Your Property Details then click “next”

About Your Business

Google Analytics About Your Business

The final GA account setup step is to provide some straightforward details about your business, such as Industry Category, business size, and how do you intend to use Google Analytics with your business.

Click “Create” after selecting all the relevant options to create GA4 and Universal Analytics Property.

After, you will be asked to read and accept Google Analytics’ terms of service. Now Click “I Accept” then arrive at your GA dashboard.

2. Set Up Your Data Stream

You will be prompted to set up the data stream flow the first time you visit the GA4 dashboard.

Google Analytics Data Stream

Select the “Web” option, then you will go to an interface to add your domain URL and name your data stream.

Google Analytics Data Stream Info

Enhanced Measurements

In GA4, Google has predefined a number of advanced metrics to measure, in addition to the “standard” metrics. You can toggle these measurements on or off by selecting the “Settings” icon.

Google Analytics Data Stream Info Created
Google Analytics Data Stream Enhanced Measurements

3. Start Collecting Data From Your Website

Since your data stream is the gateway to your GA4 portal to actually collect data from your site and send it there, you need to add the Analytics tag to your web pages.

From the above flow details click on “View tag instructions” to get the Google Analytics 4 tracking code (gtag.js)

Google Analytics tracking code

Now, login to Admin Panel then go to Content > Configuration Then choose store need add GA4. Paste the copied code into “Scripts and Style Sheets” then click “Save Configuration”.

Google Analytics add tracking js

We have just finished setting up Google Analytics 4 for Magento 2 website. In the next posts we will learn How To Set Up Google Analytics 4 Using GTM. Contact us if you face any problems during the installation process.