Archived topic
Up-to-date guide for installation of GTM with Data Layer
5 replies · Started by Alex on April 19, 2020
Hey,
I hope you're all staying safe. I was just looking into replacing a plugin combination that I have with GeneratePress Elements so that it's easier to manage + keep my install lean.
Is there an up-to-date guide available for how to handle this as well as the data layer segment of the install using what is now Elements (no longer Hooks)?
Thanks in advance,
Hi there,
Here it is:
https://docs.generatepress.com/article/implement-google-tag-manager/
Hi Leo, thanks for the response – I don't see mention of the data layer in that guide though :)
Hey Alex,
What's the data layer in this case? Any examples of what you're trying to do?
Let me know :)
Hey Tom,
The data layer is the more complex/developer-oriented part of GTM that most people don't implement and it involves passing things such as WP user data (name, etc) back to GTM so that it can be used as a data layer variable.
You should still just be able to add the javascript to a Hook Element in the wp_head hook.
Of course, in order to push certain data the elements will need to have onclick events attached to them as their examples show.
When it comes to the actual <script> element(s), you can just add those to a single wp_head Hook Element and it should be good to go.