Facebook pixel embed

How do I add the Facebook Pixel in the header section of the page (index.htlml)?

@SALC, Welcome onboard! :slight_smile:

At the moment the best way of doing this is placing it in an “Embed” element. Once you place it you take the Facebook Pixels script and place it in the “Embeded Content” that appears on the right-hand side panel. Don’t forget to place the code within <script> place pixel code </script>

It is also a good idea to place the Embed element near the top of your homepage (if it is important for the pixel code) so to keep the code closer to the start of the page code when you publish.

Hey! I’m also having a little trouble with my fb pixel code. I’ve used the embed function and checked “show on all pages”. But when I look at the published code in Firefox the FB code is not in the head section, just above the tag. I placed the embed-box as high up as I could on the index.html page… Hmm. What am I doing wrong? And also - EXACTLY which code should I paste into the embed-box? See attached pic to see the code I got sent from fb… I don’t really understand the " (script) place pixel code (/script)" thing… Should I include the “(!-- Facebook Pixel Code --)”?
Ps. Had to change the < to ( - otherwise the text disappeared. Ds.

/Anders in StockholmEmbed debacle Facebook

Should I include the “(!-- Facebook Pixel Code --)”

You don’t have to. This is the syntax for comments. Those lines are just an information for the coder and have no effect on the execution of the script.

@jollygods, You mentioned “…which code should I paste in the embed-box?”
The script code doesn’t go onto the canvas. The Embed element is a placeholder for your code. The code is placed in the “Embedded Content” that appears on the right-hand side once you clicked the Embed element container on the canvas.

Also make sure to un-tick “Activate after consent” for testing but once done you’ll have to re-tick this if you are running the “Visitor Privacy”.

The Embed element container needs to be placed at the top of the page on the canvas to mimic what Facebook wants. I have done it like what I have mentioned here and all works well, so give it another try…

Hey greenskin!

Yeah, sorry if I was unclear and thanks for the reply! I did paste the code into the “embedded content” box off to the right. I’ve placed the embed element container as high up on the index.html page as possible. Is that right?
Also, if you look at my picture it says Facebook Pixel Code on the first line, and then the second line says “script”. So, my question now is - should I include all of the lines or should I leave out the first line that says Facebook Pixel Code? Maybe I’m just confusing things but to me that seems like some kind of placeholder line that fb includes just to tell you where the actual code starts and ends.
Maybe you can tell that I’m not a web programmer. :wink:

/A

Heeey sfbdesign!

I managed to miss your reply when replying to greenskin… Sorry!
And thanks for the info. That makes sense. I’ll remove those two line right now. :wink:

/A

@jollygods, The script placeholder name I usually keep in place and have no issues with it, but if you want to remove it then that is AOK as well.

Hey sfbdesign and greenskin!

I just got word from my facebook-twiddling friend that it seems to be working now! Great news. Just for the record (if it can help anyone in the future) - I removed the first and the last lines (“facebook pixel code”). And unchecked the “activate after consent” for the setup process. And the embed element container is placed as high up and to the left as possible on the index.html page. And I also checked “show on all pages”. And now it’s working. :wink:

So - thanks guys for the brilliant help!

Stay safe and hope all is good.

/Anders, Stockholm

1 Like