Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1331611
    crags_38
    Participant

    Hi

    I would like to add the Google remarketing Tag to my site. I understand that this is best to out in the functions.php file of a child theme. I have a child theme set up and have looked at this file. I have also been told it needs to go just before the </body> tag, which I can not see in this file.

    Can you please assist me in this.

    Thanks

    Craig

    PS, I have already added a Facebook tracking pixel to the above mentioned page.

    #1331625
    Lely
    Moderator

    Hello Craig,

    Thanks for posting in.
    Please add this on your functions.php file:

    function my_googleremark_footer_output() {  ?>
    
    <!–- Google Code for Remarketing Tag goes here -–>
    
    <?php }
    
    add_action( 'wp_footer', 'my_googleremark_footer_output', 99 );

    Hope this helps.

    #1333112
    crags_38
    Participant

    I already have the Facebook tracking pixel in this file, so have just put this code directly below it, separated by one blank line – is that ok?

    I assume that by putting it in the functions.php file, it is effectively inserted everywhere on the site then?

    Thanks

    Craig

    #1333159
    crags_38
    Participant

    I have just used Google’s Tag Assistant, and it says that this tag needs to be placed above the closing body tag, but there are no body tags that I can see in the functions.php file

    What can be done about this?

    Craig

    #1333219
    Lely
    Moderator

    Hello Craig,

    If the facebook tracking pixel code is also added in wp-footer, that is fine to add. Something like this:

    function thirdparty_tracking_code() {  ?>
    
    <!–- FB tracking code -–>
    
    <!–- Google Code for Remarketing Tag goes here -–>
    
    <?php }
    
    add_action( 'wp_footer', 'thirdparty_tracking_code', 99 );

    The add_action indicated where the code is added. In this case, it is on wp-footer that indicates before closing of body tag. See this:https://codex.wordpress.org/Plugin_API/Action_Reference/wp_footer

    Hope this helps.

  • <script> jQuery(function($){ $("#no-reply-1331611 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>