Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #983897

    Hi Support,

    I’ve put the facebook pixel into the child theme’s header.php.

    Now I wish to put this one on my portfoliopage ( https://mindventure.dk/mindventures/lakedistrict/ ) , so when a customer enters this page, Facebook ads manager will let me know:
    <script>
    fbq(‘track’, ‘ViewContent’);
    </script>

    And this page on the orange button “book nu” and “vis interesse”, I wish to put this code, because will be a lead from there…:
    <script>
    fbq(‘track’, ‘Lead’);
    </script>

    How is that done in the enfold theme?

    #983938

    Hey AuroraArcus,

    Thank you for using Enfold.

    Use the code or text block element of the advance layout builder. You can also use hooks or filters to add the script.

    // https://codex.wordpress.org/Plugin_API/Action_Reference/wp_head
    // https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content

    Best regards,
    Ismael

    #984077

    Hi Ismael,

    thanks, I created the code block on the landing page.

    I tried putting the:

    <script>
    fbq(‘track’, ‘Lead’);
    </script>

    into the “book nu!” button’s custom css class, but it’s not working.

    Can you describe, how I track the button? (I don’t understand the hooks and filters concept!)

    Best regards,
    Aurora

    #984141

    Hi Aurora,

    This is not the correct code, you should check FB documentation for the correct function to attach the tracking event to a button and then we can help you implement it.

    Best regards,
    Victoria

    #984203

    Hi Victoria

    Ok thanks – I will look into it. Fyi, the button is not a sale, but opens up for the possibility to mail me. I don’t know if that changes anything?

    Where should I put the code, when it’s a button?

    #984418

    Hi,

    You can still add the code or script in the code block element. The following is an example of the tracking code. You need to replace the id selector with your own. Example.

    
    <!-- Add Pixel Events to the button's click handler -->
    <script type="text/javascript">
      var button = document.getElementById('YOUR OWN CUSTOM ID SELECTOR');
      button.addEventListener(
        'click', 
        function() { 
          fbq('track', 'AddToCart', {
            content_name: 'Really Fast Running Shoes', 
            content_category: 'Apparel & Accessories > Shoes',
            content_ids: ['1234'],
            content_type: 'product',
            value: 4.99,
            currency: 'USD' 
          });          
        },
        false
      );
    </script>
    

    // https://developers.facebook.com/docs/facebook-pixel/api-reference

    Best regards,
    Ismael

    #984911

    Hi Ismael,

    Thanks for the info.
    Using the info from you and this link:
    https://developers.facebook.com/docs/facebook-pixel/events-advanced-use-cases/v3.0
    I put in this into a code block in the top of the page.

    <!– Somewhere there is a button that performs Add to Cart –>
    <button id=”addToCartButton”>Add To Cart</button>

    <!– Add Pixel Events to the button’s click handler –>
    <script type=”text/javascript”>
    var button = document.getElementById(‘Book Nu!’);
    button.addEventListener(
    ‘click’,
    function() {
    fbq(‘track’, ‘AddToCart’, {
    content_name: ‘Book Nu!’,
    value: 25,
    currency: ‘DKK’
    });
    },
    false
    );
    </script>

    Unfortunately, “Facebook pixel helper” keeps on giving me an error. Could you look through the second block of code I have put in there and tell me howcome it’s not working? (i’m trying to put a pixel trigger on the button “Book Nu!”.

    Hope you can help me out, because I’ve been stuck with this for the past 2 days…

    #984913

    Facebook also writes the following when it comes to the view a content event:

    “Paste the view content event code
    Place the event code on your content or detail page page.
    Add the event code just below the </head> tag. This allows the event code to load along with the pixel code when the page loads.
    <!– End Facebook Pixel Code –>
    </head>
    <body>
    <script>insert_event_code_here;<script>”

    Where is the “content or detail page page”?. Is it the header.php for the theme?

    #985800

    Hi,

    The id selector is invalid.

    var button = document.getElementById(‘Book Nu!’);

    The id attribute of the button is “addToCartButton”.

    var button = document.getElementById('addToCartButton');
    

    Best regards,
    Ismael

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