Archived topic
How can I modify some code lines for "Google Tag Manager" in the theme template?
8 replies · Started by noe_sp on January 28, 2019
How can I modify some code lines of "Google Tag Manager" in the theme template?
so that every time I update the theme, do not have to modify it.
Thanks in advance!
Sorry! I have "generatepress_child" instalated
Alternative to Child Theme templates is to use the GP Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
You can add the first GTM code to a WP_head hook and second code to the before_header hook.
Many thanks David for this information,
if I need to script for all pages I do it with the HOOKS?
Thanks,
Hooks are the easiest way to go, in the Hook Element > Display Rules you can select Entire Site. You can also Exclude the script for different posts / pages / templates and User Rules - such as User Role, so Admins don't trigger events for example.
Thank very much... David.
the email platform does not detect the code.
I created the element in 2 different ways:
FIRST: Choose Element Type:
as HEADER with "entire site"
SECOND: Choose Element Type:
as HOOK with "entire site"
But don't work you can help me for solve it...please.
Many thanks in advance!
They both need to be added to Hooks. So create a new hook for each of them, both will have the display rules for the entire site.
First code - select Hook: wp_head
Second code - select Hook: before_header
Hi David.... It was solved.... Work very well!!!
Was problem that email marketing platform.
Many thinks
Kind regards!
Awesome - glad you got it resolved :)