elgentos / serversideanalytics2

elgentos/serversideanalytics2

Elgentos_ServerSideAnalytics for magento 2

  • peterjaap
magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Fail Tests: N/A Security: Pass

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";

No changelog yet

The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.

Versions
Version Stability QA Status Compatibility Released
2.0.7 stable Fail Magento 2.4.7-2.4.9 Details 2026-04-23 09:50:49
2.0.6 stable Not tested Not yet tested Details 2025-05-26 10:21:06
2.0.5 stable Not tested Not yet tested Details 2025-02-05 09:57:12
2.0.4 stable Not tested Not yet tested Details 2024-12-03 10:07:59
2.0.3 stable Not tested Not yet tested Details 2024-11-14 14:20:01
2.0.2 stable Not tested Not yet tested Details 2024-11-04 15:23:14
2.0.1 stable Not tested Not yet tested Details 2024-11-04 13:48:42
1.4.1 stable Not tested Not yet tested Details 2024-11-04 08:56:40
1.4.0 stable Not tested Not yet tested Details 2024-11-02 07:25:12
2.0.0 stable Not tested Not yet tested Details 2024-08-30 13:24:20
1.3.1 stable Not tested Not yet tested Details 2024-07-05 08:26:44
1.3.0 stable Not tested Not yet tested Details 2024-06-06 10:10:04
1.2.11 stable Not tested Not yet tested Details 2024-03-27 12:55:42
1.2.10 stable Not tested Not yet tested Details 2024-03-25 11:28:45
1.2.9 stable Not tested Not yet tested Details 2024-02-28 13:36:07
1.2.8 stable Not tested Not yet tested Details 2024-02-14 13:46:47
1.2.7 stable Not tested Not yet tested Details 2024-01-26 11:25:48
1.2.6 stable Not tested Not yet tested Details 2024-01-18 15:44:06
1.2.5 stable Not tested Not yet tested Details 2024-01-12 08:06:47
1.2.4 stable Not tested Not yet tested Details 2023-11-06 11:12:27
1.2.3 stable Not tested Not yet tested Details 2023-10-31 13:55:23
1.2.2 stable Not tested Not yet tested Details 2023-10-18 08:27:49
1.2.1 stable Not tested Not yet tested Details 2023-10-17 12:16:16
1.2.0 stable Not tested Not yet tested Details 2023-10-13 07:54:06
1.1.6 stable Not tested Not yet tested Details 2023-09-22 07:36:10
1.1.5 stable Not tested Not yet tested Details 2023-09-20 09:22:28
1.1.4 stable Not tested Not yet tested Details 2023-09-20 09:18:14
1.1.3 stable Not tested Not yet tested Details 2023-09-19 15:05:19
1.1.2 stable Not tested Not yet tested Details 2023-09-19 14:37:00
1.1.1 stable Not tested Not yet tested Details 2023-09-18 15:18:12
1.1.0 stable Not tested Not yet tested Details 2023-09-11 08:42:45
1.0.2 stable Not tested Not yet tested Details 2023-01-24 14:36:16
1.0.1 stable Not tested Not yet tested Details 2022-09-20 11:44:28
1.0.0 stable Not tested Not yet tested Details 2022-09-15 13:40:50
0.1.10 stable Not tested Not yet tested Details 2022-08-30 13:34:26
0.1.9 stable Not tested Not yet tested Details 2022-07-21 10:18:49
0.1.8 stable Not tested Not yet tested Details 2022-05-02 15:59:56
0.1.7 stable Not tested Not yet tested Details 2022-03-31 04:23:53
0.1.6 stable Not tested Not yet tested Details 2021-02-09 12:49:06
0.1.5 stable Not tested Not yet tested Details 2020-08-18 14:51:34
0.1.3 stable Not tested Not yet tested Details 2019-10-28 15:54:45

Requires 2

Package Constraint
php >=8.2.0
br33f/php-ga4-mp ^0.1.5

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Warning 50 50 warnings (ruleset: Magento2) — 25 auto-fixable with phpcbf
PHPMD Warning 6 6 rule violations (UnusedFormalParameter:4, UnusedLocalVariable:2)
Cpd Pass 0
Composer validate Info 1 valid; 1 advisory note (composer validate --strict)

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 16 16
2.4.8 17 17
2.4.9 17 17

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
Authors

More from elgentos

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.