📊 State of Magento 2025

The Home for Magento 2 Excellence

Quality-tested Magento 2 modules. Explore. Evaluate. Elevate. #magento2

606 Modules
385 Ready
218 Need Help
🏆 Leaderboard
Stable v2.0.6

Serve Side Analytics for Magento 2

elgentos/serversideanalytics2

This extension aims to solve the problem of discrepancies between Magento revenue reports and the revenue reports in Google Analytics.

89,977
Downloads
Below average
70
GitHub Stars
Above average
8mo ago
Last Release
3
Open Issues
Build Issues
2/3 checks passed

Build Tests

Composer Install
DI Compile
Templates

Code Quality

CS Coding Standard
140 warnings
PHPStan Failed

Tested on Magento 2.4.8-p3

Recent Test History

Each release is tested against the latest Magento version at that time.

v2.0.6 on Magento 2.4.8-p3
Dec 15, 2025
v2.0.6 on Magento 2.4.8-p2
Aug 14, 2025
v2.0.6 on Magento 2.4.8
Jun 14, 2025
v2.0.5 on Magento 2.4.8
May 17, 2025
v2.0.5 on Magento 2.4.7-p4
Feb 15, 2025
v2.0.5 on Magento 2.4.7-p3
Feb 7, 2025

+12 older tests

Looking for Contributors

Dependency injection compilation fails. Your contribution could help the entire Magento community!

Contribute

Share This Module's Status

Serve Side Analytics for Magento 2 Magento compatibility status badge

README

Loaded from GitHub

Server Side Analytics for Magento 2

This extension aims to solve the problem of discrepancies between Magento revenue reports and the revenue reports in Google Analytics.

That problem arises due to the fact that a certain number of people close the browser window before returning to Magento's success page. Since Google Analytics is Javascript based, and thus client based, the GA Purchase Event will not be fired and the order will not be registered in Analytics.

Another reason why this problem arises is that people decide to pay at a later point in time through a different platform (like the PSP's), using a link in an email for example.

Installation

composer require elgentos/serversideanalytics2
bin/magento setup:upgrade

Sample query for GraphQL to set the GA data

mutation AddGaUserId($cartId: String!, $gaUserId: String, $gaSessionId: String) {
                            AddGaUserId(input: {
                                    cartId: $cartId
                                    gaUserId: $gaUserId
                                    gaSessionId: $gaSessionId
                                }
                            ),
                            {
                               cartId
                               maskedId
                            }
                    }

Further info

  • Compatible with GA4 Measurement Protocol;
  • When using YireoGTM, you can either disable the purchase event on the success page, or simply not send it to GA with GTM. Or just keep it, since Google will fix double transactionId's
  • Debugging is enabled when Magento is in developer mode. See var/log/system.log for the log;
  • Exceptions will be logged to var/log/exceptions.log;
  • The products in the payload are retrieve on invoice-basis, not on order-basis;
  • An event has been added for you to add or overwrite custom fields to products in the purchase event; elgentos_serversideanalytics_product_item_transport_object;
  • An event has been added for you to add or overwrite custom fields to transaction data in the purchase event; elgentos_serversideanalytics_transaction_data_transport_object;
  • An event has been added for you to add or overwrite fields to tracking data in the purchase event; elgentos_serversideanalytics_tracking_data_transport_object;
  • Testing can be done by dispatching test_event_for_serversideanalytics with a $payment (\Magento\Sales\Order\Payment) object in the payload;
  • magerun2 dev:events:fire --eventName sales_order_payment_pay --parameters "payment::\Magento\Sales\Model\Order\Payment:X;invoice::\Magento\Sales\Model\Order\Invoice:X";

This content is fetched directly from the module's GitHub repository. We are not the authors of this content and take no responsibility for its accuracy, completeness, or any consequences arising from its use.