Poprawa obsługi Google Tag Manager w szablonie produktu

This commit is contained in:
2025-03-21 23:08:18 +01:00
parent 434e4a6464
commit abb5e0aa31
3 changed files with 19 additions and 17 deletions

BIN
templates_user/.DS_Store vendored Normal file

Binary file not shown.

BIN
templates_user/components/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -241,23 +241,25 @@
<script class="footer" type="text/javascript" src="/libraries/fancybox3/js/wheel.js"></script>
<script class="footer" type="text/javascript" src="/plugins/OwlCarousel/owl.carousel.js"></script>
<script type="text/javascript">
<? if ( $this -> settings['google_tag_manager_id'] ):?>
dataLayer.push({
event: "view_item",
ecommerce: {
items: [
{
item_id: "<?= $this -> product -> id;?>",
item_name: "<?= str_replace( '"', '', $this -> product -> language['name'] );?>",
price: '<? if ( $this -> product -> price_brutto_promo ): echo \S::normalize_decimal( $this -> product -> price_brutto_promo ); else: echo \S::normalize_decimal( $this -> product -> price_brutto ); endif;?>',
quantity: 1,
google_business_vertical: "retail"
}
],
value: <? if ( $this -> product -> price_brutto_promo ): echo \S::normalize_decimal( $this -> product -> price_brutto_promo ); else: echo \S::normalize_decimal( $this -> product -> price_brutto ); endif;?>
}
});
<? endif;?>
$( function() {
<? if ( $this -> settings['google_tag_manager_id'] ):?>
dataLayer.push({
event: "view_item",
ecommerce: {
items: [
{
item_id: "<?= $this -> product -> id;?>",
item_name: "<?= str_replace( '"', '', $this -> product -> language['name'] );?>",
price: '<? if ( $this -> product -> price_brutto_promo ): echo \S::normalize_decimal( $this -> product -> price_brutto_promo ); else: echo \S::normalize_decimal( $this -> product -> price_brutto ); endif;?>',
quantity: 1,
google_business_vertical: "retail"
}
],
value: <? if ( $this -> product -> price_brutto_promo ): echo \S::normalize_decimal( $this -> product -> price_brutto_promo ); else: echo \S::normalize_decimal( $this -> product -> price_brutto ); endif;?>
}
});
<? endif;?>
});
</script>
<script class="footer" type="text/javascript">
$( function ()