You can add Enhanced Ecommerce tracking scripts as and where you prefer in the template code from Backoffice > Ecommerce > Theme > Edit HTML/CSS.
Google Enhanced Ecommerce developers guide (developers.google.com)
Use HTML, JavaScript and Twig to implement event tracking.
Google events related to "promotions" and "refunds" are not supported.
In the implementation of the event tracking script "purchase" for orders placed:
- Add/modify the "class" attribute of the
<html>
tag present in the skeleton.html file, adding the value "disable-analytics-on-cart" (<html class="disable-analytics-on-cart">
). - Remove the standard ga() tracking script present in the pay.html and payments.html files, to avoid duplicate tracking on Analytics.
- Insert the following portion of JavaScript code into pay.html and payments.html files so that the tracking of an order is not sent several times (for example, if the user reloads the page).
var analyticsSended = {{ order.analytics_sended | json_encode }};
if (analyticsSended !== true) {
Storeden.setAnalyticsDataSended('{{order.orderID}}', function(res) {});
...insert here ga or enhanced tracking code, depending on the case...
}
Comments