Jump to content

Archived

This topic is now archived and is closed to further replies.

illinimatt81

Insert Code into Header for Facebook Pixel

Recommended Posts

illinimatt81

I'm looking to insert the Facebook Custom Audience code into the header that is displayed on all pages. This is for creating a custom audience for advertising. What is the best way to accomplish adding code into the header?

 

Facebook's instructions are "Copy the code below and paste it between the <head> and </head> in your website code."

Share this post


Link to post
Share on other sites
Simon

Either add it to the scripts edit area in wp-admin, or use a wordpress php hook.

Share this post


Link to post
Share on other sites
illinimatt81

Well if I put it in the dms header.php wouldn't it get over written with theme updates? I have the pagelines customize plugin, is there a way to add it there?

Share this post


Link to post
Share on other sites
Simon

The scripts area in wp-admin pagelines page. no need to edit any files.

Share this post


Link to post
Share on other sites
illinimatt81

Are you referring to this area? See: http://screencast.com/t/HfGjnR0GWuXE

 

If so, I saw that but was thrown off by the text about being a fallback and if the site has loading issues.

Share this post


Link to post
Share on other sites
illinimatt81

Are you referring to this area? See: http://screencast.com/t/HfGjnR0GWuXE

 

If so, I saw that but was thrown off by the text about being a fallback and if the site has loading issues.

 

I tested this and it does not work. It only loads it when logged into wp-admin. Can you send a screenshot of where I should be looking to insert the code?

Share this post


Link to post
Share on other sites
Simon

Yea put it there and click save.

Share this post


Link to post
Share on other sites
illinimatt81

Yea put it there and click save.

 

I did that but it is only active when the DMS editor is open. I verified this by using the Facebook Pixel tracking Google Chrome extension. It detected the pixel when I was logged in and in the DMS editor, but if I log out of the site the code is not activated on the page and the tracking extension verified no script.

 

It has to go somewhere else. It tracks all web visitors to any page and builds an audience on FB that you can target later of your traffic to the website.

Share this post


Link to post
Share on other sites
illinimatt81

I downloaded a plugin for this and got it to work. (https://wordpress.org/plugins/header-footer/) I am trying to minimize the number of plugins as per best practices so if anyone has better suggestions where I can just copy and paste the code into the sitewide header on every page without I am open to hearing them.

Share this post


Link to post
Share on other sites
Simon

You cant just copy/paste you will either need to put it in the scripts box, or use a php action, which is probably what that header footer plugin does anyway.

Share this post


Link to post
Share on other sites
illinimatt81

Ok, thanks for the insight. I was looking for something that wasn't there it seems. The plugin is serving it's purpose so I will consider this resolved!

Share this post


Link to post
Share on other sites

×