This topic has 5 replies, 2 voices, and was last updated 9 years by marcogovoni.

  • Author
  • #51148
     marcogovoni
    Participant

    How can I put a code (a tracking facebook pixel code) in the Head section of a SPECIFIC page (in this case the registration page) ?

    thank you

    #51163
     Radu
    Moderator

    Hello,

    Add this code to your kleo-child functions.php

    COPY CODE
    
    
    function checkpage() {
        
        if (is_page('contact')) {
    
        echo '<script>alert("Hello! I am an alert box!!")</script>';
        
        }
    
    }
    add_action('wp_head','checkpage');
    

    Replace the example code from echo with your preffered js code.

    Also replace contact with your page slug.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #51384
     marcogovoni
    Participant

    The code is the facebook pixel for track conversion rate: it’s seems doesn’t work …. the code is the following:

    <!– Facebook Conversion Code for registrazioni framevents –>
    <script>(function() {
    var _fbq = window._fbq || (window._fbq = []);
    if (!_fbq.loaded) {
    var fbds = document.createElement(‘script’);
    fbds.async = true;
    fbds.src = ‘//connect.facebook.net/en_US/fbds.js’;
    var s = document.getElementsByTagName(‘script’)[0];
    s.parentNode.insertBefore(fbds, s);
    _fbq.loaded = true;
    }
    })();
    window._fbq = window._fbq || [];
    window._fbq.push([‘track’, ‘6023277124511’, {‘value’:’0.00′,’currency’:’EUR’}]);
    </script>
    <noscript></noscript>

    #51385
     marcogovoni
    Participant

    the code must be in the <head> section

    #51393
     Radu
    Moderator

    Provide that tracking code inside a

    COPY CODE
     

    tag or attach a txt file with that code.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #51441
     marcogovoni
    Participant

    Hi, I’ve found this and works well 🙂

    https://wordpress.org/plugins/facebook-conversion-pixel/

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?