feat: DataLayer GA4 analytics fix — poprawka eventów ecommerce

Naprawione eventy purchase, begin_checkout, view_item, add_to_cart
do formatu GA4 (item_id/item_name zamiast id/name, currency PLN,
google_business_vertical, poprawne typy danych).
Dodany nowy event view_cart na stronie koszyka.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jacek
2026-03-25 19:01:22 +01:00
parent 18c037915f
commit 589f9d9a38
10 changed files with 435 additions and 24 deletions

View File

@@ -73,10 +73,11 @@
$begin_checkout_items .= ',';
$begin_checkout_items .= '{';
$begin_checkout_items .= '"id": "' . $product['id'] . '",';
$begin_checkout_items .= '"name": "' . $product['language']['name'] . '",';
$begin_checkout_items .= '"item_id": "' . $product['id'] . '",';
$begin_checkout_items .= '"item_name": "' . str_replace( '"', '', $product['language']['name'] ) . '",';
$begin_checkout_items .= '"price": ' . \Shared\Helpers\Helpers::normalize_decimal( $price_product['price_new'] ) . ',';
$begin_checkout_items .= '"quantity": ' . $position['quantity'];
$begin_checkout_items .= '"quantity": ' . (int)$position['quantity'] . ',';
$begin_checkout_items .= '"google_business_vertical": "retail"';
$begin_checkout_items .= '}';
?>
<? endforeach;?>