Merge branch 'ticket/r11982-ganalytics' into develop
Conflicts: modules/ganalytics/header.tpl
This commit is contained in:
commit
53eb8c1006
@ -38,6 +38,7 @@
|
||||
});
|
||||
{/foreach}
|
||||
|
||||
{if $cookie->transCpt < 2}
|
||||
ga('ec:setAction', 'purchase', { // Transaction details are provided in an actionFieldObject.
|
||||
'id': '{$trans.id}', // (Required) Transaction id (string).
|
||||
'affiliation': '{$trans.store}', // Affiliation (string).
|
||||
@ -45,6 +46,7 @@
|
||||
'tax': '{$trans.tax}', // Tax (currency).
|
||||
'shipping': '{$trans.shipping}', // Shipping (currency).
|
||||
});
|
||||
{/if}
|
||||
|
||||
{literal}
|
||||
var re = new RegExp("([?&])(email=)[^&#]*", "g");
|
||||
|
@ -42,6 +42,42 @@ class OrderConfirmationController extends OrderConfirmationControllerCore
|
||||
require_once _PS_ROOT_DIR_.'/modules/privatesales_delay/saledelay.php';
|
||||
$products = SaleDelay::associateDelay($products);
|
||||
}
|
||||
|
||||
$analytics_timeover = 0;
|
||||
$transCpt = 0;
|
||||
|
||||
// Cookie
|
||||
global $cookie;
|
||||
// Reset
|
||||
if (isset($cookie->id_transaction)) {
|
||||
if ($cookie->id_transaction != $order->id) {
|
||||
unset($cookie->id_transaction);
|
||||
unset($cookie->transCpt);
|
||||
}
|
||||
}
|
||||
// Set counter
|
||||
if (isset($cookie->transCpt)) {
|
||||
$transCpt = (int) $cookie->transCpt;
|
||||
}
|
||||
$transCpt++;
|
||||
if ($transCpt > 1) {
|
||||
$analytics_timeover = 1;
|
||||
}
|
||||
// Check date order if page is refresh and not affect analytics
|
||||
if ($analytics_timeover == 0) {
|
||||
$timestamp_check = new DateTime();
|
||||
$timestamp_check->createFromFormat('Y-m-d H:i:s', $order->date_add);
|
||||
$timestamp_check->add(new DateInterval('PT10M'));
|
||||
$timestamp = $timestamp_check->getTimestamp();
|
||||
if (time() > $timestamp) {
|
||||
$analytics_timeover = 1;
|
||||
$transCpt++;
|
||||
}
|
||||
}
|
||||
// Write cookie
|
||||
$cookie->transCpt = $transCpt;
|
||||
$cookie->id_transaction = $order->id;
|
||||
$cookie->write();
|
||||
|
||||
self::$smarty->assign(
|
||||
array(
|
||||
@ -49,7 +85,8 @@ class OrderConfirmationController extends OrderConfirmationControllerCore
|
||||
'order' => $order,
|
||||
'address_delivery' => $address_delivery,
|
||||
'address_invoice' => $address_invoice,
|
||||
'products' => $products
|
||||
'products' => $products,
|
||||
'analytics_timeover' => $analytics_timeover,
|
||||
)
|
||||
);
|
||||
self::$smarty->display(_PS_THEME_DIR_.'order-confirmation.tpl');
|
||||
|
Loading…
Reference in New Issue
Block a user