Archived topic
Can Hooks be used to insert Facebook pixel code?
3 replies · Started by mmarvel on July 28, 2017
Hi
Can I use hooks to insert facebook pixel javascript code into the header and fb view_page into the body of a page?
Thanks. MJ
Hi there,
Absolutely. Try the wp_head hook.
https://generatepress.com/forums/topic/where-do-i-install-my-facebook-pixel/
Thanks Leo.
I'm not quite sure the difference between these
wp_head vs before header <--- they both seem like before <head>
header vs after header <--- both seem like before </head>
before content is before <body> ?? but then that would also be before </head>
before footer is like before </body> ??
I'm little confused since i'm just use to putting code in before </head> , after </head> or before footer usually before </body> so could you either point me to where these are covered in your doc's or give me the overview.
My apologies if this is already covered somewhere.
B/R Martha
wp_head is a standard WordPress hook that is more to store like functions, Google Analytics.
Before header is more for regular HTML contents.