add view_item_list

This commit is contained in:
MaxBUhe 2023-01-10 14:22:49 +01:00
parent 76e7bd10f6
commit 1aad369e36
2 changed files with 10 additions and 24 deletions

View File

@ -1,10 +1,12 @@
[{assign var="gtmProducts" value=$products}]
[{if $gtmProducts|@count}]
[{strip}]
<script>
/* ga4 */
dataLayer.push({ecommerce: null});
dataLayer.push({
'event':'GA4_event',
'event':'view_item_list',
'event_name': 'view_item_list',
'ecommerce': {
'items': [
@ -23,29 +25,6 @@
]
}
});
/* ua */
dataLayer.push({ecommerce: null});
dataLayer.push({
'event':'UA_event',
'event_name': 'view_item_list',
'ecommerce': {
'currencyCode':'EUR',
'impressions': [
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
{
'id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$gtmProduct->oxarticles__oxprice->value|default:'0'}],
'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'position': [{$smarty.foreach.gtmProducts.iterator|default:1}]
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
[{/foreach}]
]
}
});
</script>
[{/strip}]
[{/if}]

View File

@ -117,6 +117,13 @@ $aModule = [
'template' => 'page/checkout/thankyou.tpl',
'block' => 'checkout_thankyou_main',
'file' => '/Application/views/blocks/checkout_s5.tpl'
],
// Lists
// view_item_list
[
'template' => 'widget/product/list.tpl',
'block' => 'd3Ga4_view_item_list',
'file' => '/Application/views/ga4/view_item_list.tpl'
]
],
'settings' => [