Hi,
Please help me. How do I insert Facebook pixel tracking code on my simple enfold buttons at sales page?
Facebook support: https://developers.facebook.com/docs/marketing-api/audiences-api/pixel#inpageevents
Thank you for your support!
Best regards,
Daniella
Hey Daniella,
Please enable the custom css class field: http://kriesi.at/documentation/enfold/turn-on-custom-css-field-for-all-alb-elements/ and then edit your button element and give it a custom CSS class (“my-custom-button” in example below) and then add following code to Functions.php file in Appearance > Editor
function av_custom_fb_pixel(){
?>
<script>
jQuery(window).load(function(){
jQuery(".my-custom-button a").removeAttr("href");
jQuery(".my-custom-button a").attr("onClick","fbq('track', 'Purchase');");
});
</script>
<?php
}
add_action('wp_footer', 'av_custom_fb_pixel');
Best regards,
Yigit
Hi Yigit,
Thank you for your reply. I did everything.
One problem is now: not working the link on the button.
What did I do wrong?
Do I have to enter the link in the code (.removeAttr(“href”)??
Big Thanks,
Daniella
Hi Daniella,
In example code there was no Href attribute, therefore i removed it. If you will need to use href attribute, please change the code to following one
function av_custom_fb_pixel(){
?>
<script>
jQuery(window).load(function(){
jQuery(".my-custom-button a").attr("onClick","fbq('track', 'Purchase');");
});
</script>
<?php
}
add_action('wp_footer', 'av_custom_fb_pixel');
Best regards,
Yigit
Thank you Yigit, it’s working. :))
Have a nice day!
Daniella
Hi Daniella,
Glad that Yigit helped you. Thanks for using Enfold :)
Best regards,
Nikko
