fix: Poprawki dataLayer GA4 — purchase price, format kluczy, fałszywa konwersja GADS
- purchase: id→item_id (string), name→item_name, price fallback na price_brutto gdy brak promo, user_data poza ecommerce - begin_checkout: id→item_id, name→item_name, dodano google_business_vertical - Usunięto fałszywą konwersję GADS (gtag conversion) ze strony checkout - view_item: dodano currency PLN, price jako number zamiast string - Dodano event view_cart na stronie koszyka - add_to_cart: quantity parseInt zamiast string Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -247,16 +247,17 @@
|
||||
dataLayer.push({
|
||||
event: "view_item",
|
||||
ecommerce: {
|
||||
currency: "PLN",
|
||||
value: <? if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>,
|
||||
items: [
|
||||
{
|
||||
item_id: "<?= $this -> product['id'];?>",
|
||||
item_name: "<?= str_replace( '"', '', $this -> product['language']['name'] );?>",
|
||||
price: '<? if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>',
|
||||
price: <? if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>,
|
||||
quantity: 1,
|
||||
google_business_vertical: "retail"
|
||||
}
|
||||
],
|
||||
value: <? if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>
|
||||
]
|
||||
}
|
||||
});
|
||||
<? endif;?>
|
||||
@@ -573,7 +574,7 @@
|
||||
item_id: "<?= $this -> product['id'];?>",
|
||||
item_name: "<?= str_replace( '"', '', $this -> product['language']['name'] );?>",
|
||||
price: <? if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>,
|
||||
quantity: quantity,
|
||||
quantity: parseInt(quantity),
|
||||
google_business_vertical: "retail"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user