first commit
This commit is contained in:
244
web/common/templates/orderViewTracking.tpl
Normal file
244
web/common/templates/orderViewTracking.tpl
Normal file
@@ -0,0 +1,244 @@
|
||||
{get_order_info type='heurekaDisagree' order=$body.order assign=heurekaDisagree}
|
||||
|
||||
{block "google-analytics"}
|
||||
<!-- Google Analytics -->
|
||||
{if $dbcfg.analytics.ga4.ID}
|
||||
{assign var=shipping_price value=$body.order->getDeliveryPrice()}
|
||||
<script>
|
||||
gtag('event', 'purchase', {
|
||||
"transaction_id": "{$body.order.id}",
|
||||
"affiliation": "Odeslana objednavka",
|
||||
"value": {$body.order.total_price},
|
||||
"currency": "{$body.order.currency}",
|
||||
"tax": {$body.order.total_price_array.value_vat},
|
||||
"shipping": {$shipping_price.value_with_vat},
|
||||
"items": [
|
||||
{foreach $body.order.items as $product}
|
||||
{if $product.id_product}
|
||||
{
|
||||
"id": "{$product.id_product}{if $product.id_variation}-{$product.id_variation}{/if}",
|
||||
"name": "{$product.descr}",
|
||||
// "list_name": "Search Results",
|
||||
"brand": "{$product.producer}",
|
||||
"category": "{$product.section_name}",
|
||||
"variant": "",
|
||||
"list_position": {$product@iteration},
|
||||
"quantity": {$product.pieces},
|
||||
"price": "{$product.piece_price.value_with_vat}"
|
||||
},
|
||||
{/if}
|
||||
{/foreach}
|
||||
]
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{if $dbcfg.analytics.fb_pixel.id}
|
||||
<script>
|
||||
fbq('track', 'Purchase', { currency: "{$body.order.currency}", value: {$body.order.total_price} });
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
<!-- Google Konverze -->
|
||||
{if $dbcfg.analytics.google_conversion.ID}
|
||||
<!-- Google Code for nákup Conversion Page -->
|
||||
<script>
|
||||
gtag('event', 'conversion', {
|
||||
'send_to' : '{if $dbcfg.analytics.google_conversion.ID|strpos:'AW-' === false}AW-{$dbcfg.analytics.google_conversion.ID}{else}{$dbcfg.analytics.google_conversion.ID}{/if}/{$dbcfg.analytics.google_conversion.label}',
|
||||
'value': {$body.order.total_price},
|
||||
'currency': '{$body.order.currency}',
|
||||
'transaction_id': '{$body.order.id}',
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
<!-- Heureka Conversion -->
|
||||
{block "getHeurekaItemId"}
|
||||
{function getHeurekaItemId}{if (findModule('marketing', 'product_identifier') == 'code')}{$product.code}{else}{$product.id_product}{if $product.id_variation}_{$product.id_variation}{/if}{/if}{/function}
|
||||
{/block}
|
||||
{if $dbcfg.analytics.heureka_conversion.backend_only != 'Y' && ($dbcfg.analytics.heureka_conversion.ID || $dbcfg.analytics.heureka_conversion.ID_SK) && !$heurekaDisagree}
|
||||
<script type="text/javascript">
|
||||
var _hrq = _hrq || [];
|
||||
{if $dbcfg.analytics.heureka_conversion.ID_SK && $body.order.invoice_country == 'SK'}
|
||||
_hrq.push(['setKey', '{$dbcfg.analytics.heureka_conversion.ID_SK}']);
|
||||
{else}
|
||||
_hrq.push(['setKey', '{$dbcfg.analytics.heureka_conversion.ID}']);
|
||||
{/if}
|
||||
|
||||
_hrq.push(['setOrderId', '{$body.order.id}']);
|
||||
|
||||
{foreach $body.order.items as $product}
|
||||
{if $product.id_product}
|
||||
_hrq.push(['addProduct', {$product.descr|json_encode nofilter}, '{$product.piece_price.value_with_vat}', '{$product.pieces}', '{getHeurekaItemId product=$product}']);
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
_hrq.push(['trackOrder']);
|
||||
|
||||
(function() {
|
||||
var ho = document.createElement('script'); ho.type = 'text/javascript'; ho.async = true;
|
||||
{if ($dbcfg.analytics.heureka_conversion.ID_SK && $body.order.invoice_country == 'SK') || ($ctrl.active_language == 'sk' && $dbcfg.analytics.heureka_conversion.ID)}
|
||||
ho.src = 'https://im9.cz/sk/js/ext/2-roi-async.js';
|
||||
{else}
|
||||
ho.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.im9.cz/js/ext/1-roi-async.js';
|
||||
{/if}
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ho, s);
|
||||
})();
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
{if $dbcfg.analytics.new_conversion_code.backend_only != 'Y' && ($dbcfg.analytics.new_conversion_code.ID || $dbcfg.analytics.zbozi_cz_feedback.ID) && !$heurekaDisagree}
|
||||
<!-- Měřicí kód Sklik.cz + Zboží.cz-->
|
||||
<script type="text/javascript" src="https://c.seznam.cz/js/rc.js"></script>
|
||||
<script>
|
||||
{if $cfg.marketingLogging}
|
||||
Sentry.captureMessage("conversion init");
|
||||
{/if}
|
||||
|
||||
var conversionConf = {
|
||||
{if $dbcfg.analytics.new_conversion_code.ID}
|
||||
id: {$dbcfg.analytics.new_conversion_code.ID},
|
||||
{/if}
|
||||
value: {unapplyCurrency($body.order.total_price_array.value_without_vat->asInteger())},
|
||||
orderId: "{$body.order.order_no}",
|
||||
{if $dbcfg.analytics.zbozi_cz_feedback.ID}
|
||||
zboziType: {if isDevelopment()}"sandbox"{else}"standard"{/if},
|
||||
zboziId: "{$dbcfg.analytics.zbozi_cz_feedback.ID}",
|
||||
{/if}
|
||||
consent: 1
|
||||
};
|
||||
|
||||
if (window.rc && window.rc.conversionHit) {
|
||||
{if $cfg.marketingLogging}
|
||||
Sentry.captureMessage("conversion send");
|
||||
{/if}
|
||||
window.rc.conversionHit(conversionConf);
|
||||
}
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
{if $dbcfg.analytics.trusted_shop.id}
|
||||
{send_trusted_shop apikey=$dbcfg.analytics.trusted_shop.id order=$body.order source='https://www.compari.ro/'}
|
||||
{/if}
|
||||
|
||||
{if $dbcfg.analytics.affilbox && $dbcfg.analytics.affilbox.instance}
|
||||
{$note_admin = $body.order.note_admin|json_decode:true}
|
||||
<script type="text/javascript">
|
||||
var ab_instance = "{$dbcfg.analytics.affilbox.instance}";
|
||||
var ab_kampan = "{$dbcfg.analytics.affilbox.kampan}";
|
||||
var ab_cena = "{unapplyCurrency($body.order.total_price_without_vat)}";
|
||||
var ab_id_transakce = "{$body.order.order_no}";
|
||||
var ab_mena = "{$body.order.currency}";
|
||||
{if count($note_admin.discounts.used_coupons|default: []) > 0}
|
||||
var ab_kupon = "{$note_admin.discounts.used_coupons|reset}";
|
||||
{else}
|
||||
var ab_kupon = "";
|
||||
{/if}
|
||||
</script>
|
||||
<script src="https://{$dbcfg.analytics.affilbox.instance}/c3.js" type="text/javascript" async defer></script>
|
||||
{/if}
|
||||
|
||||
{if $dbcfg.analytics.cjtracking.CID}
|
||||
<!-- BEGIN CJ CONVERSION TAG -->
|
||||
<script type="text/javascript">
|
||||
if (!window.cj) window.cj = { };
|
||||
{assign var='discountField' value=0}
|
||||
{get_session_value type='cjevent' assign='cjEventSessionValue'}
|
||||
cj.order = {
|
||||
enterpriseId: {$dbcfg.analytics.cjtracking.CID},
|
||||
pageType: 'conversionConfirmation',
|
||||
{$user = ($ctrl) ? $ctrl->getUser() : false}
|
||||
{if $user}
|
||||
userId: '{$user->id}',
|
||||
{/if}
|
||||
emailHash: '{hash('sha256', $body.order.invoice_email|strtolower|trim)}',
|
||||
orderId: '{$body.order.order_no}',
|
||||
actionTrackerId: {$dbcfg.analytics.cjtracking.TYPE},
|
||||
currency: '{$body.order.currency}', // required
|
||||
amount: '{$body.order.total_price_without_vat}',
|
||||
{get_order_info type='getUsedCoupons' assign=coupons order=$body.order}
|
||||
coupon: '{join(",", $coupons)}',
|
||||
cjeventOrder: '{$smarty.cookies.cjevent|default:$cjEventSessionValue}',
|
||||
customerCountry: '{$body.order.invoice_country}',
|
||||
items: [
|
||||
{foreach $body.order.items as $item}
|
||||
{if !empty($item['note']['totalDiscount']) && empty($item['note']['discounts'])}
|
||||
{$discountField=$discountField+$item['note']['totalDiscount']|floatval}
|
||||
{/if}
|
||||
{if $item.id_product}
|
||||
{
|
||||
'unitPrice': {$item.piece_price.value_without_vat},
|
||||
'itemId': '{$item.id_product}{if $item.id_variation}_{$item.id_variation}{/if}',
|
||||
'quantity': {$item.pieces},
|
||||
'discount': ''
|
||||
},
|
||||
{elseif (!empty($item['note']))}
|
||||
{if $item['note']['coupon']}
|
||||
{$coupon = $item['note']['coupon']}
|
||||
{elseif $item['note']['generated_coupon']['code']}
|
||||
{$coupon = $item['note']['generated_coupon']['code']}
|
||||
{else}
|
||||
{$coupon = null}
|
||||
{/if}
|
||||
{if $coupon && ($item['piece_price']['value_without_vat']->asFloat() < 0)}
|
||||
{$discountField=$discountField+(-$item['piece_price']['value_without_vat']->asFloat())}
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
],
|
||||
{if $discountField > 0}
|
||||
'discount': {$discountField|floatval}
|
||||
{/if}
|
||||
};
|
||||
</script>
|
||||
<!-- END CJ CONVERSION TAG -->
|
||||
{/if}
|
||||
|
||||
|
||||
{if $dbcfg.analytics.google_customer_reviews.merchant_id}
|
||||
<!-- BEGIN Kód přihlašovacího modulu GCR -->
|
||||
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn"
|
||||
async defer>
|
||||
</script>
|
||||
<script>
|
||||
window.renderOptIn = function () {
|
||||
window.gapi.load('surveyoptin', function () {
|
||||
window.gapi.surveyoptin.render(
|
||||
{
|
||||
// REQUIRED
|
||||
"merchant_id": {$dbcfg.analytics.google_customer_reviews.merchant_id},
|
||||
"order_id": "{$body.order.order_no}",
|
||||
"email": "{$body.order.invoice_email}",
|
||||
"delivery_country": "{$body.order.delivery_country}",
|
||||
{if $body.order->getData('deliveryDate')}
|
||||
{$estimated_delivery_date = $body.order->getData('deliveryDate')|date_format:'Y-m-d'}
|
||||
{else}
|
||||
{$estimated_delivery_date = $body.order.date_created|date_format:'Y-m-d'}
|
||||
{/if}
|
||||
"estimated_delivery_date": "{$estimated_delivery_date}",
|
||||
// OPTIONAL
|
||||
{$eans = []}
|
||||
{foreach $body.order.items as $item}{if $item.ean}{$eans[] = $item.ean}{/if}{/foreach}
|
||||
{if $eans}
|
||||
"products": [{foreach $eans as $item}{ldelim}"gtin": "{$item}"{rdelim}{if $item@last}{else}, {/if}{/foreach}],
|
||||
{/if}
|
||||
"opt_in_style": "BOTTOM_RIGHT_DIALOG"
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<!-- END Kód přihlašovacího modulu GCR -->
|
||||
|
||||
<!-- BEGIN Kód jazyka GCR -->
|
||||
<script>
|
||||
window.___gcfg = {
|
||||
lang: "{$ctrl.active_language}"
|
||||
};
|
||||
</script>
|
||||
<!-- END Kód jazyka GCR -->
|
||||
{/if}
|
||||
|
||||
|
||||
{block "other_services"}{/block}
|
||||
|
||||
Reference in New Issue
Block a user