2023-03-20 09:49:49 +01:00
|
|
|
[{$smarty.block.parent}]
|
|
|
|
[{assign var="gtmProduct" value=$oView->getProduct()}]
|
|
|
|
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
|
|
|
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
|
|
|
|
2023-08-03 15:55:07 +02:00
|
|
|
[{block name="d3_ga4_view_item_block"}]
|
|
|
|
[{capture assign=d3_ga4_view_item}]
|
|
|
|
[{strip}]
|
|
|
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
2023-06-21 14:24:47 +02:00
|
|
|
|
2023-08-03 15:55:07 +02:00
|
|
|
dataLayer.push({
|
|
|
|
'event': 'view_item',
|
|
|
|
'eventLabel':'Product View',
|
|
|
|
'ecommerce': {
|
|
|
|
'currency': '[{$currency->name}]',
|
|
|
|
'items': [
|
|
|
|
{
|
|
|
|
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
|
|
|
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
|
|
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
|
|
|
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
|
|
|
[{if $gtmCategory}]
|
|
|
|
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
|
|
|
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
|
|
|
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
|
|
|
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
|
|
|
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
|
|
|
[{/if}]
|
|
|
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
|
|
|
'price': [{$d3PriceObject->getPrice()}]
|
|
|
|
}
|
|
|
|
]
|
2023-08-16 10:44:50 +02:00
|
|
|
}[{if $oViewConf->isDebugModeOn()}],
|
|
|
|
'debug_mode': 'true'
|
|
|
|
[{/if}]
|
2023-08-03 15:55:07 +02:00
|
|
|
});
|
|
|
|
[{/strip}]
|
|
|
|
[{/capture}]
|
|
|
|
[{oxscript add=$d3_ga4_view_item}]
|
|
|
|
[{/block}]
|