Jump to content

The Stratega

Member
  • Posts

    2
  • Joined

  • Last visited

Everything posted by The Stratega

  1. This hook worked and was able to be verified immediately for my Facebook Pixel. Create a file. ( I named it FBPixel.php ) in: /includes/hooks/FBPixel.php Add the following code and replace 123456 for your Pixel Id. or copy your pixel code in between the "return <<<HTML and HTML;" tags. Save and test your pixel. Mine was immediately verified. You can also view the source code of your page and you can see the pixel code below there. Hope this helps. JC <?php /** * Facebook Pixel Code * @author JC */ add_hook('ClientAreaHeadOutput', 1, function($vars) { return <<<HTML <!-- 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', '123456'); //Your pixel ID here. fbq('track', 'PageView'); </script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=123456&ev=PageView&noscript=1" /></noscript> <!-- End Facebook Pixel Code --> HTML; });
  2. The hook solution worked like a charm and verified instantly!. Thanks brian!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated