How to use a Facebook or Twitter ad-tracking pixel in WordPress

If you’ve considered advertising your brand on social media, there’s a lot to know. Creating an ad in Facebook, Twitter, Instagram, or Pinterest can be very complicated. Even after you’ve created an ad, there’s still more to be done — and that’s where a Facebook or Twitter “pixel” comes in. Thankfully, using a pixel on your WordPress site is easier than it may seem, and it’ll make a big difference if you want to track the success of your social media advertising campaigns.

What is a pixel?

The word pixel has a wide range of uses. In the digital imaging world, a pixel is essentially one “dot” on a screen. Google is rumored to be releasing a new phone called the Pixel. But in the social media world, the term has yet another meaning. As it relates to social media, a pixel is a small piece of code that can be installed on a website so social sites can track clickthrough rates. Pinterest calls them conversion tags, but they’re based on the same concept.

Why do you need a Facebook or Twitter pixel on your site?

If you want to track the effectiveness of an ad you’ve created on social media, the social site that hosts your ad needs to be able to connect to your site. For example, if you create an ad on Facebook, Facebook can track how many people see the ad and how many people click it, because those activities take place within their site. However, what happens after that takes place on your site, so if you want to know how many people took an action once they got to your site — such as purchasing a product or signing up for an email list — you need a pixel or conversion tag so the social site can collect and compile this information for you.

How do you add a pixel to your site?

Depending on the social media site you’re wanting to track, plugins are available to allow you to integrate a pixel into a WordPress site easily.

Facebook and Instagram

Facebook’s official WordPress plugin hasn’t been updated in 3 years, so it’s not a reliable choice. A third-party plugin called PixelYourSite, however, offers a lot of versatility. It’s compatible with WooCommerce and it supports Advance Matching, a Facebook tracking technique that matches up your site’s visitors to their Facebook profile. In case you’re wondering about privacy, Facebook claims this technique is secure, and they also claim an increase in conversions by over 10%.

Another unofficial Facebook plugin called Facebook Conversion Pixel allows you to quickly and easily add a Facebook pixel into WordPress. It adds a meta box to each page on your site that enables you to add a different pixel to each page. That way you can track your ad campaigns in greater detail, enabling you to see which pages a user visited after landing on your site from an ad.

Since Facebook owns Instagram, Instagram ads are sold and tracked through Facebook. If you set up a Facebook pixel on your site, you’ll be good to go with Instagram as well.


Twitter’s official WordPress plugin provides pixel support with a shortcode. It’s important to note that Twitter’s terms of service requires your website to make a disclosure in your privacy policy that you’re using a tracker on your site. More information can be found on Twitter’s development website. (Privacy note: MPWR Design does not use any social media pixels or trackers that identify individuals who view the site.)

If you run ads on social media that target a specific action — selling a product, collecting email subscribers, and so on — pixels and conversion trackers can be a really handy tool. They’ll give you the ability to not only track how many people clicked your ad but also how many completed the action you desired. For more information, see Facebook’s Pixel Implementation Guide and Twitter’s Conversion Tracking for Websites guide.

Where should you place a pixel?

Once you’re set up with a plugin, it’s important to understand how to use it. For the best insight, it’s ideal to create a separate pixel for each page of your site that you want a visitor to view. For example, if you create an ad campaign for a product you want someone to purchase, you can add a pixel in that product’s page, another pixel on your checkout page, and another pixel on the page that shows after someone has completed checkout. This way you can measure how many people made it through each step. If you see a significant drop-off from one step to another, you’ll know where you’re losing your customers.

In the comments, let us know about your experience with social media marketing. Have you used social media ads before? Have you used a tracking pixel? What information have you gained from it?