elgentos / serversideanalytics2
Elgentos_ServerSideAnalytics for magento 2
Installs: 60 568
Dependents: 0
Suggesters: 0
Security: 0
Stars: 64
Watchers: 10
Forks: 24
Open Issues: 5
Type:magento2-module
Requires
- php: >=8.2.0
- br33f/php-ga4-mp: ^0.1.5
- dev-master
- 2.0.2
- 2.0.1
- 2.0.0
- 1.4.1
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.2
- 1.0.1
- 1.0.0
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.3
- dev-store-id-as-function-params
- dev-update-whitelist-db
- dev-WouterSteen-patch-7
- dev-WouterSteen-patch-6
- dev-WouterSteen-patch-5
- dev-WouterSteen-patch-4
- dev-WouterSteen-patch-3
- dev-WouterSteen-patch-2
- dev-ga-factory
- dev-feature/fallbacksessionid-generation-mode
- dev-added-log-file
- dev-send-user-id-to-ga
- dev-create-fallback-session-id
- dev-create-fake-session-id-when-using-add-blocker
- dev-support-for-payments-that-not-have-order-id
- dev-WouterSteen-patch-1-1
- dev-WouterSteen-patch-1
- dev-hotfix-getting-order
- dev-update-clean-up
- dev-add-license-1
- dev-add-event-to-transaction-object
This package is auto-updated.
Last update: 2024-11-04 15:23:17 UTC
README
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.
Installations
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
}
}
Caveats
- This extension disables the JS Purchase Event on the success page altogether. It will however track the pageview.
Further info
- Compatible with UA Measurement Protocol and GA4 Measurement Protocol;
- 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";