Your address will show here +12 34 56 78

Home Forums WP ESTATE – Real Estate WordPress Theme FORUM Where to put social conversion tracking code

This topic contains 1 reply, has 2 voices, and was last updated by  Camelia Support Team – WP Estate 2 years, 6 months ago.

  • Author
    Posts
  • #106672

    Tealady46
    Participant

    Hi All

    I’ve been grappling with the easiest way to add tracking code for specific pages, mainly for tracking conversions. Most of the advice is to put the code into the <head> section of the relevant page. However, this isn’t really possible for dynamically generated page.

    However, I stumbled on some great advice and tested it out for some Facebook code I needed to add and it worked, so thought I’d share it here.

    Hope this helps for anyone else who had a similar problem.

    Appearance > Editor > Functions.php

    Then just before the closing ?>
    Add the following:

    function custom_code(){
    if ( is_page( 1122 )) {
    ?>
    CODE HERE
    <?php
    }
    }
    add_action(‘wp_footer’, ‘custom_code’);

    Believe me, I have virtually zero knowledge of PHP, so it surprised that the solution ended up being so simple!!

    Deborah Plowright
    chezdechez.com

  • #106830

    Hi Deborah,
    Thank you for sharing this with us.
    Maybe it will help someone else.
    Thank you,
    Camelia

You must be logged in to reply to this topic.