add view_search_result
This commit is contained in:
parent
1aad369e36
commit
6b039b6c9a
@ -0,0 +1,32 @@
|
|||||||
|
[{$smarty.block.parent}]
|
||||||
|
|
||||||
|
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||||
|
|
||||||
|
[{if $gtmProducts|@count}]
|
||||||
|
[{strip}]
|
||||||
|
<script>
|
||||||
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
|
dataLayer.push({
|
||||||
|
'event': 'view_search_result',
|
||||||
|
'eventLabel':'view_search_result',
|
||||||
|
'ecommerce': {
|
||||||
|
'search_term': '[{$searchparamforhtml}]',
|
||||||
|
'items': [
|
||||||
|
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
||||||
|
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||||
|
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
|
||||||
|
{
|
||||||
|
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||||
|
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||||
|
'price': [{$gtmProduct->oxarticles__oxprice->value|default:'0'}],
|
||||||
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
|
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
||||||
|
'quantity': 1
|
||||||
|
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||||
|
[{/foreach}]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
[{/strip}]
|
||||||
|
[{/if}]
|
@ -124,6 +124,12 @@ $aModule = [
|
|||||||
'template' => 'widget/product/list.tpl',
|
'template' => 'widget/product/list.tpl',
|
||||||
'block' => 'd3Ga4_view_item_list',
|
'block' => 'd3Ga4_view_item_list',
|
||||||
'file' => '/Application/views/ga4/view_item_list.tpl'
|
'file' => '/Application/views/ga4/view_item_list.tpl'
|
||||||
|
],
|
||||||
|
// view_search_result
|
||||||
|
[
|
||||||
|
'template' => 'page/search/search.tpl',
|
||||||
|
'block' => 'search_results',
|
||||||
|
'file' => '/Application/views/ga4/search.tpl'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'settings' => [
|
'settings' => [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user