Skip to content

Analytics (GA4 / GTM)

VIDEO WALKTHROUGH

Analytics & Tracking: setup guide

2:35

Recorded on version 1.0.3 · Narrated walkthrough · English captions

Jump to a chapter 8 chapters
Read the full video transcript
Analytics & Tracking 1.0.3 — Magento Admin setup

00:00:00 — Set up Analytics & Tracking
Welcome to the Agentic Ecom Analytics & Tracking Admin guide. We'll walk through the main setup screens and the checks to make before using the module. This guide assumes the extension is already installed.

00:00:13 — Open settings and choose scope
Start in Magento Admin and open Stores, Configuration. Choose Analytics & Tracking. Check the Scope selector before editing. Use the appropriate website or store view where the setting supports it. The screen values here are a demonstration; enter the settings and service details that belong to your own store.

00:00:33 — Enable the integration
Enable Analytics at the intended store scope. Have your own Google Analytics measurement I D and Tag Manager container I D ready. Decide how the storefront will emit each event, rather than assuming a configuration value alone proves that tracking is active.

00:00:51 — Configure Google Analytics
Enter the measurement I D and review the available event-group switches and purchase-value choices. Check the Product Attributes settings for the product identifier, brand attribute and category depth. Use consistent catalogue identifiers so product events can be interpreted correctly in your analytics reports.

00:01:11 — Configure the tag manager
If you use Google Tag Manager, enable it and enter the intended container I D. Review the separate Google Ads settings only for the tags and conversions you actually use. A headless storefront must integrate and verify the relevant event payloads and browser triggers.

00:01:30 — Check consent and server-side tracking
Review Privacy and Consent settings with your storefront or tag manager. Server-Side Tracking has separate options and an API secret. Verify browser and server event behaviour, consent changes and purchase deduplication in staging before relying on reports. Check a test event in Google's diagnostic tools after saving.

00:01:51 — Save and verify your setup
When your required settings are complete, use the screen's Save control and wait for Magento's confirmation. Then reopen the record or configuration and check the saved values at the intended scope. If the storefront still shows earlier settings, refresh the relevant caches. Test your own configuration before using it with customers.

00:02:13 — Your setup checklist
That's the Admin setup walkthrough for Analytics & Tracking. Check permissions and scope, review the module-specific settings, then save and verify a small staging example. Use the written guide at user guides dot Agentic Ecom dot net for installation details, complete field references and any separate storefront integration steps.

Analytics wires Magento into the Google measurement stack — GA4, Google Tag Manager and Google Ads for a headless store. Magento exposes selected GA4 event payloads over GraphQL; integrate and verify the relevant view_item, view_item_list, add_to_cart and purchase triggers in your storefront. The package also has server-side tracking, Consent Mode settings, Google Ads configuration and an in-admin sales dashboard.

Current direct-store release: 1.0.4. The Admin dashboard now appears under Reports → Analytics. This fixes a missing Magento menu parent that could prevent the Admin menu from loading when Analytics was installed with other modules.

Analytics dashboard

Install Analytics (GA4 / GTM) with Composer using your AgenticEcom licence key (find it on your My Licences page — one key unlocks every module you own):

Terminal window
# 1. Register the AgenticEcom repository (once per store)
composer config repositories.agenticecom composer https://repo.agenticecom.net
composer config --global --auth http-basic.repo.agenticecom.net <YOUR-LICENCE-KEY> x
# 2. Require this module
composer require agenticecom/module-analytics
# 3. Apply it
php bin/magento setup:upgrade && php bin/magento setup:di:compile && php bin/magento cache:flush

Magento

Review the exact release against your Open Source 2.4.x version.

PHP

Check the exact package requirements and test your PHP version.

Headless

Selected GA4 event payloads and config over GraphQL.

Privacy

Consent Mode defaults, hashed customer identifiers, per-IP rate limiting.

Headless data layer (the hard part, solved)

Section titled “Headless data layer (the hard part, solved)”

A headless storefront can’t use Magento’s page-rendered GTM snippet — it has to build the GA4 data layer itself. This module hands it over ready-made:

{ analyticsConfig {
gtm_container_id ga4_measurement_id enabled
enhanced_ecommerce cookie_consent_required consent_mode_default
google_ads { tag_id conversion_enabled conversion_send_to
remarketing_enabled remarketing_id } } }

The storefront can use these settings to configure GTM/GA4/Ads tags. Validate the conversion_send_to (AW-XXXX/LABEL) value before enabling a purchase conversion.

A set of event builders and configurable tracking switches. Wire and test the events your storefront uses:

view_item · view_item_list · add_to_cart · remove_from_cart · view_cart · begin_checkout · add_shipping_info · add_payment_info · add_to_wishlist · purchase · search · login · sign_up.

Server-side events

Forward events to GA4 via the Measurement Protocol (an API secret), so conversions are recorded even when ad-blockers or ITP strip the client-side tag. A cron also back-fills any missed purchases.

Consent Mode

Ship Google Consent Mode v2 defaults (granted/denied) so tags respect the visitor’s cookie choice from the first page view.

Google Ads

Fire purchase conversions and dynamic remarketing with the right send_to value, assembled for you from the conversion ID + label.

Privacy-safe

Customer identifiers are SHA-256 hashed, the public event endpoint accepts a bounded set of GA4 events and is rate-limited per IP. It rejects public purchase and refund forwarding; order data is ownership-checked.

Reports → Analytics → Dashboard gives you a quick in-Magento read on sales performance — a revenue trend chart plus a per-day grid of orders, revenue, invoiced and refunded totals — so you don’t have to leave the admin for a top-line view.

Stores → Configuration → AgenticEcom · Sales, Customers & Marketing → Analytics & Tracking

Analytics configuration

GroupKey settings
GeneralEnable the module.
Google Analytics 4Measurement ID and the available event-group tracking switches; choose whether to include tax in purchase value.
Google Tag ManagerEnable + container ID.
Product AttributesProduct identifier (SKU/ID), brand attribute, category tracking + depth.
Google AdsTag ID, conversion ID/label + enable, remarketing ID + enable.
PrivacyConsent Mode on/off and default state.
Server-SideEnable Measurement-Protocol forwarding, API secret, headless flag, track missing purchases, track admin orders.
How does a headless storefront get the right GA4 events?

It can query analyticsConfig for tag settings and analyticsDataLayer(page_type, entity_id) for a page’s event payload. Connect that payload to the storefront’s actual GA4 or GTM dispatch path, then verify it in a consent-aware browser session and GA4 DebugView.

Can anyone query another customer’s order data?

No. analyticsOrderData requires a logged-in customer and verifies the order belongs to them, so the purchase payload is only ever returned to its owner.

Is the public tracking endpoint abusable?

It’s hardened: only a fixed allow-list of recognised GA4 event names is accepted, and it’s rate-limited per client IP — so it can’t be used to inject arbitrary events or flooded.

Does it respect cookie consent?

Yes — it ships Google Consent Mode defaults you control, so tags honour the visitor’s choice, and customer identifiers are hashed before they’re sent.

Will conversions still record if the client tag is blocked?

Enable server-side tracking and events are sent to GA4 via the Measurement Protocol from your server, with a cron that back-fills any purchases the client-side tag missed.