[Support request] Google Tag Manager trying to inject localbusiness schema code ld+json

Home Forums Support [Support request] Google Tag Manager trying to inject localbusiness schema code ld+json

Home Forums Support Google Tag Manager trying to inject localbusiness schema code ld+json

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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.

    GeneratePress 2.1.2
    #606902
    Tom
    Lead Developer
    Lead Developer

    Where are you placing the code?

    #607014
    Paul

    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.

    #607127
    Tom
    Lead Developer
    Lead Developer

    Perhaps 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
    }
    #607146
    Paul

    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

    #607469
    Tom
    Lead Developer
    Lead Developer

    GP 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 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.