[Changed] capture implementation

reworked to a safer path-through to get the data
This commit is contained in:
MaxBUhe 2023-12-18 11:59:12 +01:00
parent 9ea5408e44
commit e2564f613a
6 changed files with 12 additions and 12 deletions

View File

@ -1,7 +1,7 @@
[{$smarty.block.parent}] [{$smarty.block.parent}]
[{block name="d3_ga4_purchase_block"}] [{block name="d3_ga4_purchase_block"}]
[{capture assign=d3_ga4_purchase}] [{capture name="d3_ga4_purchase"}]
[{strip}] [{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */ dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
[{assign var="gtmOrder" value=$oView->getOrder()}] [{assign var="gtmOrder" value=$oView->getOrder()}]
@ -52,5 +52,5 @@
}) })
[{/strip}] [{/strip}]
[{/capture}] [{/capture}]
[{oxscript add=$d3_ga4_purchase}] [{oxscript add=$smarty.capture.d3_ga4_purchase}]
[{/block}] [{/block}]

View File

@ -6,7 +6,7 @@
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}] [{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
[{block name="d3_ga4_view_cart_block"}] [{block name="d3_ga4_view_cart_block"}]
[{capture assign=d3_ga4_view_cart}] [{capture name="d3_ga4_view_cart"}]
[{strip}] [{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */ dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({ dataLayer.push({
@ -46,5 +46,5 @@
}); });
[{/strip}] [{/strip}]
[{/capture}] [{/capture}]
[{oxscript add=$d3_ga4_view_cart}] [{oxscript add=$smarty.capture.d3_ga4_view_cart}]
[{/block}] [{/block}]

View File

@ -4,7 +4,7 @@
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}] [{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{block name="d3_ga4_view_item_block"}] [{block name="d3_ga4_view_item_block"}]
[{capture assign=d3_ga4_view_item}] [{capture name="d3_ga4_view_item"}]
[{strip}] [{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */ dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
@ -36,5 +36,5 @@
}); });
[{/strip}] [{/strip}]
[{/capture}] [{/capture}]
[{oxscript add=$d3_ga4_view_item}] [{oxscript add=$smarty.capture.d3_ga4_view_item}]
[{/block}] [{/block}]

View File

@ -3,7 +3,7 @@
[{block name="d3_ga4_remove_from_cart_block"}] [{block name="d3_ga4_remove_from_cart_block"}]
[{if $hasBeenReloaded}] [{if $hasBeenReloaded}]
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}] [{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
[{capture assign=d3_ga4_remove_from_cart}] [{capture name="d3_ga4_remove_from_cart"}]
[{strip}] [{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */ dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({ dataLayer.push({
@ -43,6 +43,6 @@
}); });
[{/strip}] [{/strip}]
[{/capture}] [{/capture}]
[{oxscript add=$d3_ga4_remove_from_cart}] [{oxscript add=$smarty.capture.d3_ga4_remove_from_cart}]
[{/if}] [{/if}]
[{/block}] [{/block}]

View File

@ -6,7 +6,7 @@
[{block name="d3_ga4_view_item_list_block"}] [{block name="d3_ga4_view_item_list_block"}]
[{if $gtmProducts|@count}] [{if $gtmProducts|@count}]
[{capture assign=d3_ga4_view_item_list}] [{capture name="d3_ga4_view_item_list"}]
[{strip}] [{strip}]
dataLayer.push({ecommerce: null}); dataLayer.push({ecommerce: null});
dataLayer.push({ dataLayer.push({
@ -41,6 +41,6 @@
}); });
[{/strip}] [{/strip}]
[{/capture}] [{/capture}]
[{oxscript add=$d3_ga4_view_item_list}] [{oxscript add=$smarty.capture.d3_ga4_view_item_list}]
[{/if}] [{/if}]
[{/block}] [{/block}]

View File

@ -4,7 +4,7 @@
[{block name="d3_ga4_view_search_result_block"}] [{block name="d3_ga4_view_search_result_block"}]
[{if $gtmProducts|@count}] [{if $gtmProducts|@count}]
[{capture assign=d3_ga4_view_search_result}] [{capture name="d3_ga4_view_search_result"}]
[{strip}] [{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */ dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({ dataLayer.push({
@ -39,6 +39,6 @@
}); });
[{/strip}] [{/strip}]
[{/capture}] [{/capture}]
[{oxscript add=$d3_ga4_view_search_result}] [{oxscript add=$smarty.capture.d3_ga4_view_search_result}]
[{/if}] [{/if}]
[{/block}] [{/block}]