Last active
October 26, 2016 03:38
-
-
Save mattallan/324269b13510eb06bd2b9021dd7f4943 to your computer and use it in GitHub Desktop.
Research Prospress Pixel Tracking on post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Research Prospress Pixel Conversion code | |
* Description: A plugin to bootup our Facebook Pixels on research.prospress.com | |
* Author: Prospress | |
* Author URI: https://research.prospress.com | |
* Version: 1.0 | |
*/ | |
/** | |
* Load Facebook Pixel inside <head> on specific post on https://research.prospress.com | |
* | |
* Ref: https://developers.facebook.com/docs/facebook-pixel/api-reference | |
*/ | |
function pp_research_add_fb_pixel_header() { ?> | |
<?php if ( is_single( 98 ) ) : ?> | |
<script type="text/javascript"> | |
!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', '1303350309717571' ); | |
fbq( 'track', 'PageView' ); | |
jQuery( function() { | |
jQuery("#research-calendly").click( function() { | |
fbq( 'track', 'CompleteRegistration' ); | |
}); | |
}); | |
</script> | |
<noscript> | |
<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1303350309717571&ev=PageView&noscript=1" /> | |
</noscript> | |
<?php endif; | |
} | |
add_action( 'wp_head', 'pp_research_add_fb_pixel_header' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment