Skip to content

Commit 5931901

Browse files
committed
ACP2E-1880: send numeric values for product qty and price, total, shipping and tax.
1 parent 83b7f30 commit 5931901

File tree

1 file changed

+10
-10
lines changed
  • app/code/Magento/GoogleAnalytics/Block

1 file changed

+10
-10
lines changed

app/code/Magento/GoogleAnalytics/Block/Ga.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ public function getOrdersTrackingCode()
124124
"ga('ec:addProduct', {
125125
'id': '%s',
126126
'name': '%s',
127-
'price': '%s',
128-
'quantity': %s
127+
'price': '%f',
128+
'quantity': %d
129129
});",
130130
$this->escapeJsQuote($item->getSku()),
131131
$this->escapeJsQuote($item->getName()),
@@ -138,9 +138,9 @@ public function getOrdersTrackingCode()
138138
"ga('ec:setAction', 'purchase', {
139139
'id': '%s',
140140
'affiliation': '%s',
141-
'revenue': '%s',
142-
'tax': '%s',
143-
'shipping': '%s'
141+
'revenue': '%f',
142+
'tax': '%f',
143+
'shipping': '%f'
144144
});",
145145
$order->getIncrementId(),
146146
$this->escapeJsQuote($this->_storeManager->getStore()->getFrontendName()),
@@ -235,16 +235,16 @@ public function getOrdersTrackingData()
235235
$result['products'][] = [
236236
'id' => $this->escapeJsQuote($item->getSku()),
237237
'name' => $this->escapeJsQuote($item->getName()),
238-
'price' => $item->getPrice(),
239-
'quantity' => $item->getQtyOrdered(),
238+
'price' => (float)$item->getPrice(),
239+
'quantity' => (int)$item->getQtyOrdered(),
240240
];
241241
}
242242
$result['orders'][] = [
243243
'id' => $order->getIncrementId(),
244244
'affiliation' => $this->escapeJsQuote($this->_storeManager->getStore()->getFrontendName()),
245-
'revenue' => $order->getGrandTotal(),
246-
'tax' => $order->getTaxAmount(),
247-
'shipping' => $order->getShippingAmount(),
245+
'revenue' => (float)$order->getGrandTotal(),
246+
'tax' => (float)$order->getTaxAmount(),
247+
'shipping' => (float)$order->getShippingAmount(),
248248
];
249249
$result['currency'] = $order->getOrderCurrencyCode();
250250
}

0 commit comments

Comments
 (0)