Tagged: x
-
AuthorPosts
-
March 14, 2017 at 3:01 pm #1407043
Hi, I need to install a facebook pixel. Wondering if you can help me do this with this theme.
Here’s what they say to do:
March 14, 2017 at 3:01 pm #1407046This reply has been marked as private.March 15, 2017 at 12:09 am #1407567Hi there,
Thanks for writing in! You can follow this thread – https://community.theme.co/forums/topic/facebook-pixel-code/#post-825188
If you search on our forum before posting, you might get the answer quickly. If you don’t get the right answer, we are always here but give it a try first.
Cheers!
March 15, 2017 at 1:46 am #1407634This reply has been marked as private.March 15, 2017 at 4:35 am #1407759Hi There,
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / password
– FTP credentialsDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thanks.
March 15, 2017 at 4:27 pm #1408625This reply has been marked as private.March 15, 2017 at 11:59 pm #1409126Hi there,
Your FTP credentials not working, maybe the FTP server is not correct. Hoerver if you check the source code, you will see the script has been added properly. So the code is doing what it supposed to do, no further check required. If the code is fine, it should work fine.
Cheers!
March 19, 2017 at 4:22 am #1412597Well.. It’s not working fine in fact it’s not showing on facebook at all lol
March 19, 2017 at 9:02 pm #1413157Hello There,
Thanks for updating in! I have inspected the code and it turns out that the single quotes in the script is invalid. I already corrected it to save you some time. I changed the code to this:
// 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','https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '1724215121128079'); fbq('track', "PageView");</script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1724215121128079&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 Code // =============================================================================
Please check your site in with the Facebook Pixel now.
March 19, 2017 at 10:34 pm #1413198This reply has been marked as private.March 20, 2017 at 9:03 am #1413643Hi There,
Yes, it is correct.
Please update above code for pixel on functions.php to this:
// 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','https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '780113285485611'); fbq('track', "PageView");</script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=780113285485611&ev=PageView&noscript=1"/></noscript> <!– End Facebook Pixel Code –> <!– Insert Facebook custom audience pixel Code Code ends here –> <?php // For BLOG if(is_home()){ ?> <script> fbq('track', 'ViewContent'); </script> <?php } // For CHECKOUT if(is_checkout()){ ?> <script> fbq('track', 'InitiateCheckout'); </script> <?php } // For PURCHASE if(is_wc_endpoint_url()){ ?> <script> fbq('track', 'Purchase'); </script> <?php } // For COnvertplug if(is_page('1')){ ?> <script> fbq('track', 'CompleteRegistration'); </script> <?php } } //function closing add_action( 'wp_head', 'add_facebook_audience_pixel_code' ); // End Facebook custom audience pixel Code // =============================================================================
For Convertplug, look for this line:
if(is_page('1')){
change 1 to your convertplug thank you page ID.For add to cart, add the following code on Appearance > Customize > Custom > Edit Global JS:
jQuery('.add_to_cart_button').on('click', function() { fbq('track', 'AddToCart'); } );
Hope this helps.
March 20, 2017 at 4:54 pm #1414233Hi, it’s telling me that my add to cart trigger isn’t going and I’m not seeing any other triggers on facebook. Could you take a look?
Thanks!
March 21, 2017 at 8:50 am #1414910This reply has been marked as private. -
AuthorPosts