Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1281000
    Kelly R
    Participant

    Hi,

    I need to add a Facebook pixel to one of the tag archive pages on our blog (not sitewide). How can I place the pixel on the specific tag archive page?

    Thanks!

    #1281083
    Lely
    Moderator

    Hello Kelly,

    Thanks for posting in.

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Then add the following on your child theme’s functions.php file.

    add_action('wp_head','my_tracking_pixel');
    function my_tracking_pixel() { 
    if ( is_archive() ) {
    ?>
    
    <!-- Add Your Tracking Pixel Here -->
    
    <?php
    }
    }

    See this:https://codex.wordpress.org/Function_Reference/is_archive. If it’s specific to tag archive, please update is_archive() with is_tag(). See this:https://codex.wordpress.org/Function_Reference/is_tag

    Hope this helps.

    #1281114
    Kelly R
    Participant
    This reply has been marked as private.
    #1281161
    Lely
    Moderator

    Hello Kelly,

    That is supposed to be correct. But then I cannot confirm it because you didn’t share the exact pixel code you have added. On the frontend, we can only check if we saw the code when we view the source. I can’t see any facebook pixel code. If you have caching, try to purge cache. I am seeing Google tag manager code but not FB pixel code.

    #1281521
    Kelly R
    Participant
    This reply has been marked as private.
    #1281581
    Paul R
    Moderator

    Hi Kelly,

    I checked your code and it seems correct.

    I double checked the page source code and I can see the code getting added.

    http://screencast.com/t/dRYYO60lwGg

    If you wouldn’t mind providing us with a little more clarification on what it is you’re wanting to do (perhaps some screenshots), we’ll be happy to provide you with a response once we have a better understanding of the situation.

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