- This topic has 5 replies, 2 voices, and was last updated 7 years, 9 months ago by
Tom.
-
AuthorPosts
-
June 23, 2018 at 5:37 am #606648
Paul
Hi,
I have setup google tag manager using GP hooks , tested in preview mode of tag manager and all ok, I have setup a container in Tag Manager for custom html and placed some localbusiness schema code in there to fire on all pages. Tested again and see it firing. Published to go live. However when I test the pages on Googles schema test the schema mark up is not there.
If I place the markup directly in wp-heads it shows fine. Has anyone seen this problem before ? All page caching turned off.
Paul.
June 23, 2018 at 9:35 am #606902Tom
Lead DeveloperLead DeveloperWhere are you placing the code?
June 23, 2018 at 1:08 pm #607014Paul
Wp_head and before_header . As per previous articles.
Tag manager says its firing on page view. And now just tried for Dom load but not working. Schema is tested and no errors reported. And works fine if I put directly into wp_head.
June 23, 2018 at 8:01 pm #607127Tom
Lead DeveloperLead DeveloperPerhaps try adding it using a function like this:
add_action( 'generate_before_header', 'tu_add_google_tag_manager', 0 ); function tu_add_google_tag_manager() { ?> GTM in here <?php }June 23, 2018 at 9:21 pm #607146Paul
I have done that with the noscript part of the gtm code in there.
Same result. GTM preview mode shows me the tag firing. I then publish but no schema markup is actually in the page code other than what the GP theme puts in itself. Google’s schematic test tool shows no extra markup . I have tested the markup directly in this tool and no errors, so the markup is good.
I think for the moment I will just put the schema markup directly into the header using GP hooks. This works ok, but ultimately I want to generate the markup dynamically for different products for example.
Is there a way to have different markup for different pages. GP hooks will be the same code across all pages won’t it ?
It’s got to be something with GTM that I’m doing wrong , I will play around and experiment and let you know if I resolve it. Just thought maybe it’s something you have seen before.
Thanks for your time. Love your theme by the way.
Paul
June 24, 2018 at 9:19 am #607469Tom
Lead DeveloperLead DeveloperGP Hooks is global for now, unless you write PHP conditionals within the hook.
However, GPP 1.7 will make this MUCH easier. I’m hoping to release the alpha version on Monday 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.