google_analytics

View Magento 2 Google Analytics Extension Detail Page for Features and Demo

Documentation for Google Analytics

Preference

  • 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.

Installation

There are two ways of installing extension in magento2.

  1. Using COMMAND LINE.
  2. 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
           Php bin/magento setup:static-content:deploy

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.

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.

Step 3: 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.

Backend & Frontend Example

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 necessary 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.

  • 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 
  • Then click create.

  • 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”

  • 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.

  • If you not have any GTM account you see get started button click on this button.
  • 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 section.
  • now add Container name and select Target platform in Container Setup section.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.

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.

Go to Stores → Configuration → Mageants → Google Tag Manager. After Enable extension please add all details.

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.

  • 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 showing in Google Analytics 4 account.

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:

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.

  • 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.

  • 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.

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.

  • But your can see fired event name and Parameters After event fired within 30 second go to at Report → RealTime.

google_analytics.txt · Last modified: 2025/05/26 12:35