Tagged: x
-
AuthorPosts
-
March 9, 2017 at 7:05 pm #1401345
AnnParticipantHey there,
I was wondering if I can get some help with my Facebook pixel code. I have added the pixel before and I know it should go inside the function file in my child theme, but I’m a bit confused to where the event pixel should go (between <script> tags just below the </head> tag according to Facebook).
Here’s the Facebook Pixel:
// Add Facebook custom audience pixel Code
// =============================================================================add_action(‘wp_head’,’my_tracking_pixel’);
function my_tracking_pixel() { ?><!– 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’, ‘1519179685044320’); // 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=1519179685044320&ev=PageView&noscript=1″
/></noscript>
<!– DO NOT MODIFY –>
<!– End Facebook Pixel Code –><?php
}// End Facebook custom audience pixel Code
// =============================================================================And here’s the event pixel:
<script>
fbq(‘track’, ‘CompleteRegistration’, {
value: 34.00,
currency: ‘USD’
});
</script>And the event pixel should only be added to page-id-27850
Thank you!
Ann
March 10, 2017 at 12:10 am #1401559
RupokMemberHey Ann,
You need to place the code within Child Theme’s functions.php. If you want to place the code for specific page then you need to use is_page() function – https://developer.wordpress.org/reference/functions/is_page/
Thanks!
March 10, 2017 at 12:31 am #1401568
AnnParticipantThanks Rupok!
March 10, 2017 at 12:52 am #1401584
FriechModeratorYou’re welcome, feel free to get in touch with us regarding any further queries about the X|Theme and Cornerstone.
Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1401345 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
