Tagged: x
-
AuthorPosts
-
February 1, 2017 at 5:12 am #1353478
IanParticipantMy Facebook pixel is happily residing in my X-child theme’s functions.php.
Here’s what she looks like:
// 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', '731910656982251'); // 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=731910656982251&ev=PageView&noscript=1" /></noscript> <!-- DO NOT MODIFY --> <!-- 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 // =============================================================================My question now being – how do I go about “pixelling” individual events?
Facebook suggest adding code on a per-page basis, for example a registration page would need the additional code:
<script> fbq('track', 'CompleteRegistration', { value: 25.00, currency: 'USD' }); </script>Okie-dokie. But where on the individual page do I add the code? Would this be the RAW shortcode? Or Javascript?
Please help.
February 1, 2017 at 6:09 am #1353544
ThaiModeratorHi There,
You can add that code the raw content element.
Let us know how it goes!
February 1, 2017 at 2:16 pm #1354171
IanParticipantFor some strange reason, Cornerstone is not happy saving any changes made when I add the code via the raw content element.
February 1, 2017 at 7:23 pm #1354581
NicoModeratorHi There,
You could try adding the code in your custom JS of your cornerstone page.
IF still not working, Would you mind sharing us your admin credentials so we could check your setup. Please share us also the URL where you added the code.
Don’t forget to set it as private reply.
Thanks.
February 2, 2017 at 5:06 am #1355044
IanParticipantHi there,
Adding the code into the Custom JS of the Cornerstone page did the trick.
Thank you!
February 2, 2017 at 7:10 am #1355153
ChristianModeratorGlad you’ve sorted it out.
February 15, 2017 at 11:27 pm #1373026
EpiphanyHealthParticipantDo you include the full pixel with the event to the Custom JS of the cornerstone page, or just the event?
February 16, 2017 at 12:11 am #1373076
EpiphanyHealthParticipantI’m having the same issue. Can you help me? I added the code to the Customer JS but it the pixel isn’t firing.
February 16, 2017 at 2:17 am #1373196
RadModeratorHi there,
The first set of code goes to child theme’s functions.php since it requires proper embedding of its library. While the second code (the event code) is added is custom js (either customizer’s custom js or cornerstone’s custom js).
It shouldn’t have
<script></script>block, like thisfbq('track', 'CompleteRegistration', { value: 25.00, currency: 'USD' });Hope this helps.
February 16, 2017 at 11:09 am #1373796
EpiphanyHealthParticipantI tried putting it there, and the pixel wouldn’t fire. Am I perhaps putting it in the wrong place still? I’m pretty sure I was in the Customizer JS
February 16, 2017 at 5:28 pm #1374203
FriechModeratorHi There,
Can you confirm you added the Pixel base code on the child theme’s functions.php file?
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.
February 17, 2017 at 10:08 am #1375182
EpiphanyHealthParticipantThis reply has been marked as private.February 17, 2017 at 4:18 pm #1375617
FriechModeratorHi There,
Please remove the event code from the base pixel code, because having that on your pixel base means it will track all your pages. I’m referring to this line:
fbq('track','Lead');Lets separate that, add this on your child theme’s functions.php file. This way it will only track the page http://www.epiphanyhealthcounseling.com/almost-done/
Make sure you added this below the base code, because base code need to be called first.
function fb_print_pixel_event(){ if (is_page(717) ) : ?> <script id="fb-pixel-event"> fbq('track', 'Lead', { value: 10.00, currency: 'USD' }); </script> <?php endif; } add_action( 'wp_head', 'fb_print_pixel_event' );Hope it helps, Cheers!
February 18, 2017 at 9:56 am #1376301
EpiphanyHealthParticipantIt broke my site. I installed underneath the base pixel
February 18, 2017 at 9:56 am #1376302
EpiphanyHealthParticipantIt broke my site. I installed underneath the base pixel though I my have done something else wrong.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1353478 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
