magepal / magento2-google-tag-manager

Google Tag Manager is a user-friendly, yet powerful and cost-effective solution that is a must-have integration for every Magento store. It simplifies the process of adding and managing third-party JavaScript tags. With dozens of custom events and hundreds of data points our extensions the #1 GTM solution for Magento.

Home Page:https://www.magepal.com/google-tag-manager.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Order Data Layer attributes not loading on checkout_cart_index

willfrombrazil opened this issue · comments

Magento CE v2.1.7
magepal/magento2-googletagmanager v2.0.2

On /checkout/onepage/success/ the only data layer attributes I'm receiving are:

`<script type="text/javascript">

  | window.dataLayer = window.dataLayer || [];
  | dataLayer.push({"ecommerce":{"currencyCode":"BRL"},"pageType":"checkout_cart_index","list":"cart","customer":{"isLoggedIn":false},"cart":{"hasItems":false}});
  | </script>`

Shouldn't this page list the following data layer attributes as well?

Order

transactionId
transactionAffiliation
transactionTotal
transactionShipping
transactionTax
transactionCouponCode
transactionDiscount
transactionSubTotal
transactionProducts[].sku
transactionProducts[].name
transactionProducts[].price
transactionProducts[].quantity

Take a look at #15

You are viewing the cart page and not the order success page

In our case an array in an array was made in MagePal\GoogleTagManager\Model\Order, I changed $result[] = $transaction; to $result = $transaction; which worked for us

$result[] = $transaction; should be correct ... for muliti-shipping orders

@srenon thanks for the info. I've confirmed I'm on pageType: checkout_onepage_success.

Do you know why the transaction data layer information shows up on Tag Assistant Plugin but not on the Google Tag Manager preview tab?

download

What I'm trying to accomplish is to pass data layer information as User-Defined Variables on GTM, so I can add this info on CustomTags (eg: add transaction value and products to Facebook Conversion Pixels). But GTM isn't getting the transaction data variables:

not working

Here's a video of the steps I'm taking: https://youtu.be/k9nRURoyqSo

@willfrombrazil ...

Please upgrade to 2.0.3 and let me know if you are still having issues.

Thanks for the detailed debugging information...

@srenon - thank you for this very helpful plugin!

I've tried to update via the component manager and got a error message. Issue #24

I've successfully updated it via command line
download 1

But the transactions parameters still not showing on Google Tag Manager preview tab.

@willfrombrazil are you looking under the wrong event? Do you have a shared instance - then I can help you debug?

@willfrombrazil ... Are you still having issues?