📍
Bolt Help / Platforms / Adobe Commerce / Adobe Commerce - Managed Checkout / Google Analytics for Adobe Commerce / Magento 2
Set up Google Analytics functionality for Adobe Commerce / Magento 2.
REQUIREMENT
Google Analytics is only supported for Magento 2/Adobe Commerce merchants using the M2 API approach.
Before You Start
Upgrade to Magento 2.4.5 for GA4 compatibility.
Setup
Step 1: Configure in the Merchant Dashboard
- Retrieve your Google Analytics 4
measurementID
(formatted asG-XXXXXXX
) from your Google Analytics account. - Log into to the Merchant Dashboard.
- Navigate to Checkout.
- Go to Analytics & Tracking, then scroll to Google Analytics.
- Enter the
measurementID
into the “Google Analytics Tracking ID” into the field provided.
Step 2: Configure in Your Storefront
Add the GA4 tag to the frontend of your storefront. Replace <Measurement ID>
with your GA4 ID.
<!-- Global site tag (gtag.js) – Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<Measurement ID>"></script>
--
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<Measurement ID>');
</script>
It’s possible to setup Google Analytics using a third-party module e.g., Google Tag Manager for Magento.