hirale / openmage-ga4-measurement
A module for integrating with the Google Analytics 4 Measurement Protocol API
Installs: 25
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 1
Forks: 2
Open Issues: 0
Type:magento-module
pkg:composer/hirale/openmage-ga4-measurement
Requires
This package is auto-updated.
Last update: 2025-10-14 21:55:29 UTC
README
A module for integrating with the Google Analytics 4 Measurement Protocol API, sending events from server side.
This module can work with Mage_GoogleAnalytics module. For duplicate key events, you can consult this page https://support.google.com/analytics/answer/12313109?hl=en
Supported Events
page_viewbegin_checkoutadd_to_cartremove_from_cartview_cartpurchaseview_itemview_item_listadd_to_wishlistsign_uploginsearchview_search_results
You can check more events in the events section.
Install
Note
This module depends on openmage-redis-queue. It has been added to composer requirements.
Install with Magento Composer Installer
composer require hirale/openmage-ga4-measurement
Usage
Setup
- Generate an API SECRET in the Google Analytics UI. To create a new secret, navigate to
Admin > Data Streams > choose your stream > Measurement Protocol > Create. - Get measurement ID associated with a stream, found in the Google Analytics UI under
Admin > Data Streams > choose your stream > Measurement ID. - Go to openmage system config
System > Configuration > Sales > Google API > Measurement Protocol. Insert the parameters from step 1 and 2, save.
Debug
Enable debug mode in the openmage system config System > Configuration > Sales > Google API > Measurement Protocol.
2024-06-10T18:28:24+00:00 DEBUG (7): {"client_id":"2131884568.1715846325","timestamp_micros":1718044092903759,"non_personalized_ads":false,"user_id":"140","events":[{"name":"page_view","params":{"engagement_time_msec":1,"page_location":"https://example.com/customer/account/index/","page_title":"Create New Customer Account"}}]}
2024-06-10T18:28:24+00:00 DEBUG (7): {
"validationMessages": [ ]
}
License
The Open Software License v. 3.0 (OSL-3.0). Please see License File for more information.