diff --git a/src/TagManager/ViewItem.php b/src/TagManager/ViewItem.php index 3d7cc03..12370b9 100644 --- a/src/TagManager/ViewItem.php +++ b/src/TagManager/ViewItem.php @@ -71,23 +71,25 @@ private function addViewItemData(ProductInterface $product): void ); $data = [ - 'item_id' => $this->productIdentifierHelper->getProductIdentifier($product), - 'item_name' => $product->getName(), - 'affiliation' => $this->channelContext->getChannel()->getName(), - 'item_category' => null !== $mainTaxon ? $mainTaxon->getName() : '', - 'price' => $productVariantPrice / 100, - 'index' => 0, + 'items' => [ + 'item_id' => $this->productIdentifierHelper->getProductIdentifier($product), + 'item_name' => $product->getName(), + 'affiliation' => $this->channelContext->getChannel()->getName(), + 'item_category' => null !== $mainTaxon ? $mainTaxon->getName() : '', + 'price' => $productVariantPrice / 100, + 'index' => 0, + ], + 'currency' => $this->currencyContext->getCurrencyCode(), + 'value' => $productVariantPrice / 100, ]; - // https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_item_details + // https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#view_item_details $this->googleTagManager->addPush([ 'ecommerce' => null, ]); $this->googleTagManager->addPush([ 'event' => 'view_item', - 'currency' => $this->currencyContext->getCurrencyCode(), - 'value' => $data['price'], 'ecommerce' => $data, ]); }