yireo-magento1 / Yireo_GoogleTagManager

Implement Google Tag Manager in Magento 1 (deprecated)
Open Software License 3.0
56 stars 46 forks source link

Error - Data layer needs to be above the container snippet #51

Closed georanma closed 7 years ago

georanma commented 7 years ago

Recently found this issue when testing a migration to Tag Manager.

Tag Assistant Reports - Data layer needs to be above the container snippet

With this error occurring, the GA tag I set up would not fire on the page.

By moving the data lay above the head.phtml block in the xml layout within my own theme, I was able to resolve this. Figured Id suggest and let you guys adjust and commit.

`<?xml version="1.0"?>

`

jissereitsma commented 7 years ago

Thanks for letting us know. With which version did you make this change?

georanma commented 7 years ago

This should be with the latest version posted on the website.

Also, for the examples that were in each phtml for the events, the call to the helper is slightly off. It says Mage:helper('googletagmanager'), but I had to update to 'googletagmamager/script' to get the data layer onclick to print.

Cheers

On Apr 26, 2017 1:27 AM, "jissereitsma" notifications@github.com wrote:

Thanks for letting us know. With which version did you make this change?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yireo/Yireo_GoogleTagManager/issues/51#issuecomment-297241655, or mute the thread https://github.com/notifications/unsubscribe-auth/APZOCuvpZk7agbzZaLf5RnB8yrfaSfTBks5rztWogaJpZM4NIObt .

yireo commented 7 years ago
Hello George,
Thanks. The strange thing is that with the latest version the
  data layer and script are in the bottom anyway. We'll try to make
  some voluntary time available to see if we can replicate what you
  are mentioning, but can't promise anything.
Regards,

  Jisse Reitsma
  founder of Yireo, developer, mentor and trainer
  organizer of usergroups, trainings, developer events
  Zend Z-Team Member - zend.com/z-team
  announced as Magento Master 2017 by Magento

  May
      30th 2017 - Yireo Live Training on Magento 2 Dependency
      Injection

  Yireo - Opening Up Technology
  Extensions for Magento 1, Magento 2 and Joomla - yireo.com
  Developer trainings for Magento 1 and 2 - yireo.nl (Dutch)
  Magento Performance Insights - yireo.com/mpi

On 26-04-17 12:06, George B wrote:

This should be with the latest version posted on the
  website.

  Also, for the examples that were in each phtml for the events, the
  call to
  the helper is slightly off. It says
  Mage:helper('googletagmanager'), but I
  had to update to 'googletagmamager/script' to get the data layer
  onclick to
  print.

  Cheers

  On Apr 26, 2017 1:27 AM, "jissereitsma"
  <notifications@github.com> wrote:

  > Thanks for letting us know. With which version did you make
  this change?
  >
  > —
  > You are receiving this because you authored the thread.
  > Reply to this email directly, view it on GitHub
  >

https://github.com/yireo/Yireo_GoogleTagManager/issues/51#issuecomment-297241655,

or mute the thread

https://github.com/notifications/unsubscribe-auth/APZOCuvpZk7agbzZaLf5RnB8yrfaSfTBks5rztWogaJpZM4NIObt .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

  {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/yireo/Yireo_GoogleTagManager","title":"yireo/Yireo_GoogleTagManager","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/yireo/Yireo_GoogleTagManager"}},"updates":{"snippets":[{"icon":"PERSON","message":"@georanma in #51: This should be with the latest version posted on the website.\n\nAlso, for the examples that were in each phtml for the events, the call to\nthe helper is slightly off. It says Mage:helper('googletagmanager'), but I\nhad to update to 'googletagmamager/script' to get the data layer onclick to\nprint.\n\nCheers\n\nOn Apr 26, 2017 1:27 AM, \"jissereitsma\" \u003cnotifications@github.com\u003e wrote:\n\n\u003e Thanks for letting us know. With which version did you make this change?\n\u003e\n\u003e —\n\u003e You are receiving this because you authored the thread.\n\u003e Reply to this email directly, view it on GitHub\n\u003e \u003chttps://github.com/yireo/Yireo_GoogleTagManager/issues/51#issuecomment-297241655\u003e,\n\u003e or mute the thread\n\u003e \u003chttps://github.com/notifications/unsubscribe-auth/APZOCuvpZk7agbzZaLf5RnB8yrfaSfTBks5rztWogaJpZM4NIObt\u003e\n\u003e .\n\u003e\n"}],"action":{"name":"View Issue","url":"https://github.com/yireo/Yireo_GoogleTagManager/issues/51#issuecomment-297331530"}}}
georanma commented 7 years ago

Hey jisse,

That was the issue. Tag assistant complained about having the data layer before the closing body tag. The code I posted in github was what worked and cleared errors with tag assistant, and allowed my Google Analytics tag to print to the container.

Cheers

On Apr 26, 2017 6:13 AM, "Yireo" notifications@github.com wrote:

Hello George, Thanks. The strange thing is that with the latest version the data layer and script are in the bottom anyway. We'll try to make some voluntary time available to see if we can replicate what you are mentioning, but can't promise anything. Regards,

Jisse Reitsma founder of Yireo, developer, mentor and trainer organizer of usergroups, trainings, developer events Zend Z-Team Member - zend.com/z-team announced as Magento Master 2017 by Magento

May 30th 2017 - Yireo Live Training on Magento 2 Dependency Injection

Yireo - Opening Up Technology Extensions for Magento 1, Magento 2 and Joomla - yireo.com Developer trainings for Magento 1 and 2 - yireo.nl (Dutch) Magento Performance Insights - yireo.com/mpi

On 26-04-17 12:06, George B wrote:

This should be with the latest version posted on the website.

Also, for the examples that were in each phtml for the events, the call to the helper is slightly off. It says Mage:helper('googletagmanager'), but I had to update to 'googletagmamager/script' to get the data layer onclick to print.

Cheers

On Apr 26, 2017 1:27 AM, "jissereitsma" notifications@github.com wrote:

Thanks for letting us know. With which version did you make this change?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub

https://github.com/yireo/Yireo_GoogleTagManager/issues/ 51#issuecomment-297241655, or mute the thread

https://github.com/notifications/unsubscribe-auth/ APZOCuvpZk7agbzZaLf5RnB8yrfaSfTBks5rztWogaJpZM4NIObt .

— You are receiving this because you are subscribed to this

thread. Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4 bb","name":"GitHub"},"entity":{"external_key":"github/yireo/ Yireo_GoogleTagManager","title":"yireo/Yireo_GoogleTagManager","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/ 143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png"," avatar_image_url":"https://cloud.githubusercontent.com/ assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/yireo/Yireo_GoogleTagManager "}},"updates":{"snippets":[{"icon":"PERSON","message":"@georanma in #51: This should be with the latest version posted on the website.\n\nAlso, for the examples that were in each phtml for the events, the call to\nthe helper is slightly off. It says Mage:helper('googletagmanager'), but I\nhad to update to 'googletagmamager/script' to get the data layer onclick to\nprint.\n\nCheers\n\nOn Apr 26, 2017 1:27 AM, \"jissereitsma\" \ u003cnotifications@github.com\u003e wrote:\n\n\u003e Thanks for letting us know. With which version did you make this change?\n\u003e\n\u003e —\n\u003e You are receiving this because you authored the thread.\n\u003e Reply to this email directly, view it on GitHub\n\u003e \u003chttps:// github.com/yireo/Yireo_GoogleTagManager/issues/51#issuecomment- 297241655\u003e,\n\u003e http://github.com/yireo/Yireo_GoogleTagManager/issues/51#issuecomment-297241655%5Cu003e,%5Cn%5Cu003e or mute the thread\n\u003e \u003chttps://github.com/ notifications/unsubscribe-auth/APZOCuvpZk7agbzZaLf5RnB8yrfaSf TBks5rztWogaJpZM4NIObt\u003e\n\u003e http://github.com/notifications/unsubscribe-auth/APZOCuvpZk7agbzZaLf5RnB8yrfaSfTBks5rztWogaJpZM4NIObt%5Cu003e%5Cn%5Cu003e .\n\u003e\n"}],"action":{"name":"View Issue","url":"https://github. com/yireo/Yireo_GoogleTagManager/issues/51#issuecomment-297331530"}}}

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yireo/Yireo_GoogleTagManager/issues/51#issuecomment-297335062, or mute the thread https://github.com/notifications/unsubscribe-auth/APZOCg328E6lyiFKgAP5UQxbjHf1zRLuks5rzxjQgaJpZM4NIObt .

jissereitsma commented 7 years ago

This should be fixed in the latest release: https://github.com/yireo/Yireo_GoogleTagManager/releases/tag/1.4.1