Tagged: x
-
AuthorPosts
-
December 25, 2016 at 5:37 pm #1304108
s_mockoParticipantHi,
I am trying to set up a custom add to cart facebook pixel. But when I do an add to cart there is no link to enter for facebook to track.
What would the link be to to track when someone adds to cart?
Eurekawellness.com.au
Thanks
December 25, 2016 at 6:26 pm #1304123
s_mockoParticipantTo clarify,
I have the ajax add to cart. So when someone click add to cart button it stays on the same page. Is there a code I put in functions.php that would track everytime someone clicked the add to cart button?
Thanks
December 25, 2016 at 6:45 pm #1304227
s_mockoParticipantMerry Christmas BTW. Awesome team
December 25, 2016 at 8:46 pm #1304255
LelyModeratorHello There,
Merry Christmas to you and your family as well. This is how we add facebook pixel code:
// Add scripts to wp_head() function head_scripts() { ?> <!-- Your FB Pixel Script goes here --> <?php } add_action( 'wp_head', 'head_scripts' );We have to add the code on your child theme’s functions.php file.
Can you give us the code you were using so we can check?December 27, 2016 at 4:03 pm #1306290
s_mockoParticipantHi this is the pixel code I have been using.
<!– Facebook Pixel Code –>
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version=’2.0′;n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,’script’,’https://connect.facebook.net/en_US/fbevents.js’);
fbq(‘init’, ‘925342327542740’); // Insert your pixel ID here.
fbq(‘track’, ‘PageView’);
</script>
<noscript><img height=”1″ width=”1″ style=”display:none”
src=”https://www.facebook.com/tr?id=925342327542740&ev=PageView&noscript=1″
/></noscript>
<!– DO NOT MODIFY –>
<!– End Facebook Pixel Code –>I was not using the old pixel.
December 27, 2016 at 4:07 pm #1306294
s_mockoParticipantOh, this is what was in the functions.php in the child folder
// Add Facebook custom audience pixel Code
// =============================================================================
function add_facebook_audience_pixel_code(){
?><!– Insert Facebook custom audience pixel Code starts here –>
<!– Facebook Pixel Code –>
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version=’2.0′;n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,’script’,’//connect.facebook.net/en_US/fbevents.js’);fbq(‘init’, ‘925342327542740’);
fbq(‘track’, “PageView”);</script>
<noscript><img height=”1″ width=”1″ style=”display:none”
src=”https://www.facebook.com/tr?id=925342327542740&ev=PageView&noscript=1″
/></noscript>
<!– End Facebook Pixel Code –><!– Insert Facebook custom audience pixel Code Code ends here –>
<?php
}
add_action( ‘wp_head’, ‘add_facebook_audience_pixel_code’ );
// End Facebook custom audience pixel CodeDecember 27, 2016 at 4:07 pm #1306295
s_mockoParticipant// Add Facebook custom audience pixel Code // ============================================================================= function add_facebook_audience_pixel_code(){ ?> <!-- Insert Facebook custom audience pixel Code starts here --> <!-- Facebook Pixel Code --> <script> !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, document,'script','//connect.facebook.net/en_US/fbevents.js'); fbq('init', '925342327542740'); fbq('track', "PageView");</script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=925342327542740&ev=PageView&noscript=1" /></noscript> <!-- End Facebook Pixel Code --> <!-- Insert Facebook custom audience pixel Code Code ends here --> <?php } add_action( 'wp_head', 'add_facebook_audience_pixel_code' ); // End Facebook custom audience pixel CodeDecember 27, 2016 at 10:00 pm #1306653
FriechModeratorHi There,
Please update your code to this:
// Add Facebook custom audience pixel Code // ============================================================================= function add_facebook_audience_pixel_code(){ ?> <!-- Facebook Base Pixel Code --> <script> !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, document,'script','//connect.facebook.net/en_US/fbevents.js'); fbq('init', '925342327542740'); fbq('track', "PageView");</script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=925342327542740&ev=PageView&noscript=1" /></noscript> <!-- End Facebook Base Pixel Code --> <!-- Tracking AddToCart Code --> <script type="text/javascript"> fbq('track', 'AddToCart'); </script> <!-- End Tracking AddToCart Code --> <?php } add_action( 'wp_head', 'add_facebook_audience_pixel_code' );Let us know how it goes.
Cheers!
December 28, 2016 at 12:49 am #1306788
s_mockoParticipantHi,
Does this track standard event? Such as where do I place the standard event code in the website page at? Do I have to use a plugin for this?
Also the woocommerce page after checkout is the checkout page. How would you add the event code to this page so it fires only after order is taken and paid?Is there a plugin you recommend that works with X for this?
December 28, 2016 at 1:22 am #1306818
LelyModeratorHello There,
The code will just be added on your site on every page. But then it depends on your tracking code how it will works and which event it will fire. I found the following plugins that might help:
https://wordpress.org/plugins/pixelyoursite/ https://wordpress.org/plugins/facebook-conversion-pixel/Please just note that questions regarding integration should be forwarded to plugin developers.
Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1304108 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
