Free Google Analytics 4 – Magento 2 Plugin – GA 4 Integration

What is Google Analytics 4 ?

Google Analytics 4, also known as GA4, is the latest version of Google’s web analytics platform. It is designed to provide website owners and marketers with a more comprehensive and accurate view of their website traffic and user behavior. Unlike the previous version of Google Analytics, GA4 is built on a new and more advanced data model that uses machine learning to provide deeper insights into user behavior.

It includes a range of new features and capabilities, including event tracking, user-centric measurement, cross-device tracking, and more. It also includes an improved user interface and streamlined setup process, making it easier for users to set up and use the platform.

Overall, this new version, provides a more powerful and insightful view of website traffic and user behavior, enabling businesses and marketers to make more informed decisions and optimize their websites and marketing campaigns for maximum impact.


Integrate Google Analytics 4 In 3 Easy Steps

Step 1 – Install FREE Plugin

composer require croapp/integration

php bin/magento maintenance:enable
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento maintenance:disable
php bin/magento cache:flush

Step 2 – Get Measurement ID From GA4

  • Login to your google analytics account
  • Navigate to admin -> select the desired account & property
  • Click on Data Streams in Property
  • Click on data stream or create a new one
  • Copy MEASUREMENT ID

Step 3 – Configure GA4 In Magento 2

  • Navigate to Stores -> Configuration
  • From the left sidebar/menu, click on CRO App / GA 4 Configuration under CRO App / GA 4
  • Enter the MEASUREMENT ID copied from previous step in GA 4 Configuration Section -> GA-4 Measurement ID
  • Click Save Config on top right of the page
  • Clear cache from System ⇨ Cache Management

List Of Events Added By Plugin

  • home_viewed – Tracks homepage
  • content_page_viewed – Triggered on content cms pages like About US, Contact US
  • view_item_list – Tracks category pages i.e tracks category pages.
  • view_item – Triggered on product page i.e tracks products views / impressions / pages.
  • view_search_results – Triggered on search results page
  • sign_up – Triggered when customer is registered in frontend i.e track customer registrations in GA4.
  • login – Triggered when customer logs in to account i.e tracks customer logins.
  • logout – Triggered when customer logs out from his account i.e tracks customer logouts
  • add_to_cart – Triggered when user adds a product to cart i.e tracks add to carts.
  • remove_from_cart – Triggered when user removes a product from cart
  • view_cart – Triggered when user visit cart page
  • add_to_wishlist – Triggered when user adds product to wishlist
  • add_to_compare – Triggered when user tries to add a product to his compare list
  • remove_from_compare – Triggered when user removes a product from his compare list
  • begin_checkout – Triggered when user visits checkout page
  • purchase – Triggered when user completes order and visits order success page i.e tracks transactions / orders in magento 2

Notes

  • Some events like add_to_cartremove_from_cart may not trigger
    • Until page is reloaded.
    • Or if some cache plugin installed in magento prevents it, then in that case it will be triggered when user visits a dynamic page like cart page.
Scroll to Top