Skip to content

Commit

Permalink
Merge pull request #2027 from JustMe69/master
Browse files Browse the repository at this point in the history
#1613 TagManagerEnhancedEcommerce
  • Loading branch information
dpfaffenbauer committed Jun 24, 2022
2 parents b70585a + e0a125a commit bb59f70
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dataLayer.push({ 'event': 'csCheckout', 'checkout': {{ actionData|json_encode()|raw }} });
dataLayer.push({'event': 'csCheckout', 'ecommerce': {'checkout': {{ actionData|json_encode()|raw }} }});
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dataLayer.push({'ecommerce' : { 'purchase' : {{ actionData|json_encode()|raw }} } });
dataLayer.push({'event': 'csPurchase', 'ecommerce' : { 'purchase' : {{ actionData|json_encode()|raw }} } });
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dataLayer.push({'ecommerce' : {{ actionData|json_encode()|raw }} });
dataLayer.push({'event': 'csProductImpressions', 'ecommerce' : {{ actionData|json_encode()|raw }} });
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dataLayer.push({'ecommerce': {'detail': {{ actionData|json_encode()|raw }} }});
dataLayer.push({'event': 'csProductDetailImpressions', 'ecommerce': {'detail': {{ actionData|json_encode()|raw }} }});
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ protected function trackCartAction($product, $action, $quantity = 1): void
{
$this->ensureDataLayer();

$product['quantity'] = 1;
$product['quantity'] = $quantity;

$actionData = [$action => []];

Expand All @@ -177,7 +177,7 @@ protected function transformOrder($actionData): array
return [
'id' => $actionData['id'],
'affiliation' => $actionData['affiliation'] ?: '',
'total' => $actionData['total'],
'revenue' => $actionData['total'],
'tax' => $actionData['totalTax'],
'shipping' => $actionData['shipping'],
'currency' => $actionData['currency'],
Expand All @@ -190,11 +190,7 @@ protected function transformProductAction($item): array
'id' => $item['id'],
'name' => $item['name'],
'category' => $item['category'],
'brand' => $item['brand'],
'variant' => $item['variant'],
'price' => round($item['price'], 2),
'quantity' => $item['quantity'] ?: 1,
'list_position' => $item['position'],
]);
}

Expand Down

0 comments on commit bb59f70

Please sign in to comment.