What’s Facebook Pixel Code and How to use it?

I can’t be the only person who finds Facebook advertising confusing. All the features make it a very powerful advertising platform, but they also add complexity. One of the things I used to get particularly frustrated by is pixels. So I decided to make an article about What’s Facebook Pixel Code and How to Use it!

Intro – What’s Pixel Code?

Pixels are now common to many sites. It’s used to target people who visited your website. It helps to find your best customer and in return, you should be spending your money better. If Pixel is installed correctly – you can track visitor behavior. Advertising on Facebook gets much more effective. Pixel got introduced back in 2015. but got its popularity in a second half of 2016. Pixel is best used for e-commerce stores but it can also work for targeting people who most likely will subscribe to your newsletter. Also good to know – if you don’t plan to use Facebooks Ads there is no need for you to install Pixel.

More about Facebook Pixel

Facebook pixel is JavaScript code that you add to your website code. It follows user behavior. For instance: read an article, bought a product, subscribe to an email list or stayed in website specific amount of time.

Facebook PixelThe screenshot that I provided from one of my clients you can see that there have been 29 purchases. We can use these 29 people to create a similar audience. In this way, you should save your money on getting more targeted people.

You can also choose the type of conversion, such as “Purchase” and add a monetary value. For example, if you create a Custom Conversion that tracks visitors to an ebook download page, you can include the cost of the ebook. This feature will help you figure out if your ad campaigns are profitable. If you charge $20 for your ebook, but you’re spending $25 for every purchase that comes from Facebook ads, you’ll probably want to make some changes to that campaign.

What are benefits in reality?

  • Optimized ads. A more targeted audience that would do what you expect them to do.
  • Similar audience building. For instance blog readers, buyers or email subscribers.
  • In long term less “burned money”. Because of a pixel, we can make closer audiences to our product. For instance targeting the same group, you could pay 1.20$ for a click. After pixel and targeting better audience but in the same group, you could pay 0.80$.


How to improve your pixel code:

Not everyone knows how to improve Pixel. Pixel starts to track your customer at the same moment he visits your website. It includes even spam bots and robots, etc. With this small code, Pixel will fire after a visitor has been in website 3 seconds +.

setTimeout(function(){ *Your Facebook Pixel Code* }, 3000);

People who use WordPress I would suggest using PixelYourSite plugin. ( I’m not affiliated, just a client ). This plugin brings so much power to the table and makes installing Pixel simple.

Facebook Pixel Code

You can get your Pixel in “Ads Manager”. Just write Pixel in search when you have opened your ads manager.

This is how pixel looks:

<!-- Facebook Pixel Code -->
fbq('init', 'YOUR ID'); // Insert your pixel ID here.
fbq('track', 'PageView');
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=YOUR ID&ev=PageView&noscript=1"
<!-- DO NOT MODIFY -->
<!-- End Facebook Pixel Code -->

You can use this code together with Google Analytics. If you have any questions related to Pixel – get in touch with me. I can help with installing and improving it for you.


Leave a Reply