Magento 2 Google Analytics 4

Magento 2 Google Analytics 4 , updated 7/10/24, 9:17 AM

Google Analytics 4 Extension for Magento 2 integrates seamlessly with your e-commerce store to provide powerful insights into customer behavior and website performance. This extension supports the latest Google Analytics 4 (GA4) platform, allowing you to track and analyze crucial metrics such as user engagement, conversion rates, and sales performance in real-time. Gain deeper insights into customer journeys, optimize marketing campaigns, and make data-driven decisions to enhance your online store's effectiveness. Easy to install and configure, the Google Analytics 4 Extension helps you maximize the impact of your Magento 2 store by leveraging advanced analytics capabilities.

About MageAntsStore

MageAnts is your trusted partner of Magento Custom DevelopmentHyvä theme development solutions provider. Put your trust in us to create an online presence for you. Let us bring you into the digital age to embark on an incredible journey. Enhance your Magento store with our Magento 2 extensions & extend store functionality.

Tag Cloud

Analytics – Magento 2
USER

MANUAL


Supported Version: 2.0, 2.1, 2.2, 2.3 ,2.4
www.mageants.com support@mageants.com

1
T a b l e O
f
C
o n te
n ts

Preface……………………………………………………...…………………….3
Installation Guide…………………………………..…………….………….....4
Option 1: Magento 2 install extension using COMMAND LINE .....……....…..4
Option 2: Magento 2 install extension manually ………………………………….........5
Create Account ........….......................................……………………..... 6
Configuration....................................................................................................11
www.mageants.com support@mageants.com

2
Preface
Using Google Analytics 4 (GA4) Extension,you will be able to
view and track your website performance by collecting events using
your Google Tag Manager Account. Magento 2 Google Analytics 4 (GA4)
Extension is a straightforward module because we simply need to
create Google Tag Manager account and get the tracking code and add
it to your Magento 2 store. Using this account you can easily track your
transactions,adds-to-cart products,wishlist products and many other
events.
- This extension is providing below functionalities.

The admin can choose the product identifier variable from the backend

Generate JSON file with a single click

Observe shopping cart & checkout All events

The admin can choose to calculate the success page total

Monitor customer account events Like Login,sign up.

Order Success Page Total Calculation (subtotal / grandtotal)

Measurement Protocol Tracking for Item View

Measurement Protocol Tracking for Purchase

Measurement Protocol Tracking for Wishlist/ompare product.

www.mageants.com support@mageants.com

3
Installation:
There are two ways of installing extension in magento2.
- Using COMMAND LINE.
- Manually Install extension.
Option 1: Magento 2 install extension using COMMAND LINE (Recommended)
Follow below steps to install extension from the command line.
Step 1: Download the extension and unzip it.
Step 2: Upload it to code directory in your magento installation’s app directory If code
directory does not exists then create.
Step 3: Disable the cache under System -> Cache Management.
Step 4: Enter the following at the command line: php
bin/magento setup:upgrade
Step 5: Once you complete above steps log out and log in back to the admin panel
and switch to Stores -> Configuration -> Mageants → Analytics the
module will be displayed in the admin panel.
www.mageants.com support@mageants.com

4
Option 2: Magento 2 install extension manually
Step 1: Download the extension and unzip it.
Step 2: Upload it to code directory in your magento installation’s app directory If
code directory does not exists then create.
Step3: Disable the cache under System->Cache Management Edit
app/etc/config.php file and add one line code: ‘ Mageants_
Analytics => 1.
Step 4:
Disable the cache under System -> Cache Management
Step 5: Once you complete above steps log out and log in back to the admin
panel and switch to Stores -> Configuration -> Mageants →
Analytics, the module will be displayed in the admin panel.
www.mageants.com support@mageants.com

5
To Use Analytics Extension you have Google Analytics and
Google Tag Manager Account:
Create a Google Analytics account:
- Firstly you need to create a GA account and fill in the neces-
sary information. So click on
https://analytics.google.com/analytics/web/provision To
create account.
- click on Start measuring You see open a analytis page:
• Add your Account name and click the blue button Next at the bottom of
the page.
• Add “Your Property Name”. Then add/adjust your time zone and currency.

Click the Show advanced options right before the blue next button.
www.mageants.com support@mageants.com

6

Add your website’s Url to the first box.
• Click on the first radio button (create both a Google Analytics 4 and…)
• Click the box ‘enable enhanced measurement…’
• Select your business size is.
• Select boxes that apply to you in the ‘How do you intend on using GA
(Google Analytics)business and,
• Then click create.
www.mageants.com support@mageants.com

7
• Google will take you to its Terms of Service Agreement.
• Select your country, and
• Click the box to accept the terms of service.
• 2nd Click the other box that says you accept the Data Protection Terms.
• Then click “I Accept”
www.mageants.com support@mageants.com

8
• Once you have Done all step Your account created.
Create a Google Tag Manager account:
To Create GTM account click on your GA4 Account name in Top of the left
corner ,then select second symbol which one is GTM account.
www.mageants.com support@mageants.com

9

If you not have any GTM account you see get started button click on this but-
ton .
• Now your redirect to GTM account page now click on create account button.
• For add a new account add account name ,Country in Account Setup sec
tion
• now add Container name and select Target platform in Container Setup sec-
tion.then click on create button.
• After done all above step select data Processing terms field and finally click on top right
corner button yes.
Finally Google Analytics and Google Tag Manager account created.
www.mageants.com support@mageants.com

10
To use the GTM Magento Mageants Extension please follow below steps to
configure it:
Step1: Integrating Google Tag Manager with Website:
For getting JS and Non JS code please go to your Google Tag Manager account and
move to Account -> Container .Now go to Admin -> Install Google Tag Manager.
--> Here you can find Js and Non Js code.
CONFIGURATION:
Go to Stores->Configuration->Mageants->Google Tag Manager. After Enable extension
please add all details.
www.mageants.com support@mageants.com

11

Enable : To disable and enable extension
GTM JavaScript Code : Copy GTM Js code from Google Tag Manager and Add This
Code in this field.
GTM Non-Js Code : Copy GTM Non-Js code from Google Tag Manager and Add This
Code in this field.
Product Identifier : Using this you choose product attributes to identify Product
imported to GA4: ID or SKU.
Order Success Page Total Calculation : In this field you need to choose Calculation
of Subtotal or Grandtotal.
Step 2 : GTM API Configration

For GTM configuration, you will need account ID And , container ID from
your Google Tag Manager account.

To get Account and container Id Go to GTM account move to Account ID
→ Container ID → Workspace. Now, check the URL and copy both the
account ID and container ID.


• You will also need measurement ID from Google Analytics 4 Account.So go to
GA4 account and click Admin on the bottom left under the property
select the respective Property. Now, under the column of your property, select
the Data Streams. Then select your data stream and copy the measurement
ID.
www.mageants.com support@mageants.com

12

Once you have your account ID, container ID and measurement ID, configure
your GTM API under the Magento 2 extension configuration.
Account ID : In this field please add your Account ID which is showing in GTM
account.
Container ID : In this field please add your Container ID which is showing in
GTM account.
MEASUREMENT ID : In this field please add your Container ID which is show-
ing in Google Analytics 4 account.
www.mageants.com support@mageants.com

13
Step3 : Exporting Json File:
Public ID : In this field please add your Public Id which is showing in Google tag manager
manager account. In GTM account admin section top Right corner You your
public id.
• After adding Public Id save your configuration and click "Generate Json for GTM – Tags,
Triggers and Variables" and Download json file.In this file you can see in your download
folder.

Step4: Event Configration:
www.mageants.com support@mageants.com

14


Event : In this filed you need to choose event in which you want To analysis and showing in
GTM account.

Step5: Upload Json File in GTM account
• Once the extension is configured successfully, you require to import all the
tags, triggers and variables for the extension to work. Move to Account →
Container. Click on the Admin → Import Container, browse the downloaded
Json file, select the workspace, choose one of the import options, click
“Confirm”.
• You also See which and how many tag,variable and trigger are import.
• After Import tag successfully You can preview your tags from Workspace -> Tags.
Click “Preview” and perform all the actions on the website to verify the tags. After
finishing preview, Click “Submit” and “Publish” buttons to publish the tags.

www.mageants.com support@mageants.com

15
- After Click on Preview button You want to add website url To check Imported tag. Here
you directly redirect to your site and see event fired or not.
-
After click on connect button your perform a action Like
AddToCart,ViewCart etc. and after click on finish button Your see
Your Fired or Not fired event .
- Now you want to Publish your all tag. So click on “Submit” And
“publish” button. without publish tags no any event fired in your
website.
www.mageants.com support@mageants.com

16
• You Also see your Fired Event with value Or data in Google Analytics 4 Account.
Go to GA4 Dashbord -> Admin -> DebugView . Now all fired event show.
www.mageants.com support@mageants.com

17
Step6 . Data Tracking in Google Analytics:
• To check whether your data has been tracked from your website, login to your
Google Analytics 4 account then Go to Account And. From the left sidebar, Go To
to Reports → Engagement → Events. You can view all your events tracked.

Google Analytics 4 starts collecting data after the setup is complete, and the data
will not be updated immediately. It is conservatively estimated that it takes
approximately 24-48 hours for the data to be fully displayed in Google Analytics.

www.mageants.com support@mageants.com

18
• But your can see fired event name and Parameters After event fired within 30
second go to at Report -> RealTime.
www.mageants.com support@mageants.com

19
Thank you!
Should you have any questions or feature suggestions, please contact us at:
https://www.mageants.com/contact-us.html
Your feedback is absolutely welcome!
www.mageants.com support@mageants.com

20