Skip to content
how-to-set-up-facebook-pixel-events-for-your-ecommerce-site

How To Set Up Facebook Pixel Events For Your E-commerce Site

Not to be confused with an event to celebrate a special occasion, Facebook events are actions that happen on your website, either as a result of Facebook ads (paid) or organic reach (unpaid). With Facebook Pixel events connected to your Facebook Product Catalog, you are able to target users based on actions they take on your website. From our experience, we find that this is one of the most effective ad strategies available.

Before you can begin setting up your pixel events you’ll need to make sure you’ve added your Facebook Pixel to your website. If you need help adding your pixel to your site, Facebook has very detailed instructions on how to do it.

The Main E-Commerce Pixel Events

Facebook has three main events for e-commerce you can track: ViewContent, AddToCart, and Purchase. You can also track other events, including ViewCategory or AddToWishlist, but you only need the three main events to use dynamic ads in your ecommerce marketing and remarketing campaigns.

Have a BigCommerce site? We wrote a post earlier that details the specific instructions on How To Implement Dynamic Product Ads on BigCommerce.

ViewContent Events

The ViewContent event tells Facebook that a user viewed a certain product. There are two implementations for the ViewContent events. You’ll have to make sure you use the right content type or your events may not match to your catalog. This event should fire whenever a product page loads.

Content Type: Product Group Vs. Product

Product Group

This content type tells Facebook to match the content_id to the “item_group_id” field in your product data file.

Product

This content type tells Facebook to match the content_id to the “id” field in your product data file.

When the events fires on your product page the value in the content ID field should be the actual product ID. You can do this by using dynamic variable and adding the events script to your product pages. In most cases, you may need a developer to help you, or you can contact us for help.

Below is an example of the events script (value and currency are optional):

<script>
fbq('track', 'ViewContent', {
   content_ids: {{Product ID Variable Here}},
   content_type: 'product_group', 
   value: {{Product Price Variable Here}},
   currency: 'USD'
});
</script>

NOTE This exact script will not work for any website. You would need to customize the values for content_ids and value.

AddToCart Events

This tells Facebook that a user added a particular product to their cart. Once implemented, the AddToCart event allows you to use abandoned cart ads if a user adds a product to their cart and doesn’t purchase. This event should not fire until a user actually adds a product to their cart.

Again, remember to verify the content type and determine if you should have “product” or “product_group”.

An example of the event script (value and currency are not required, but Facebook pixel helper will not give you the green checkmark unless you have them).

You will need to customize “content_ids” and “value” in this example to be dynamic variable that work on your website.

<script>
fbq('track', 'AddToCart', {
  content_ids: {{Product ID Variable Here}}, 
  content_type: 'product_group’,
  value: {{Product Price Variable Here}}
  currency: 'USD'
});
</script>

Purchase Events

The purchase event lets Facebook know that a user purchased a product or products from your website. Using this information, Facebook allows you to specifically target or exclude these users. This event should only fire on your order confirmation page or “thank you” page.

Below is an example of the purchase event script:

<script>
fbq('track', 'Purchase, {
   content_ids: {{Product ID Variable Here}},
   content_type: 'product_group’,
   value: {{Product Price Variable Here}},
   currency: 'USD'
});
</script>

Verifying Your Pixel Events Are Working

Before testing your pixel events, you need to set up a product catalog and connect it to your Facebook pixel. If you haven’t set one up, Check out Creating A Facebook Product Catalog for instructions on how to set one up.

Navigate to a product page and use the Facebook pixel Helper extension to verify whether your events are firing and matching to the data uploaded to your Facebook Catalog.

Within the pixel helper, you should see “ViewContent”. Expand the dropdown to see the content_type and content_id. Content type should be either “product” or “product_group” and the content_id should be the unique product identifier that would match to your product upload file.

TIP: You can download the Facebook Pixel Helper extension for Chrome.

Look for “Matched Products” at the bottom of the Pixel Helper. Your catalog and pixel are set up properly if the product ID number is in that field.

Next, you need to test your AddToCart and Purchase events are also working.

Troubleshooting The Pixel Events

Why don’t I see the ViewContent events?

If you don’t see the events, then you have not implemented the events on your product page and you will likely need to work with a developer or contact us to get that setup.

Why is Content Ids empty?

If product ID is empty, then the event is properly passing the ID variable on your product page.

How do Content Type & Content Ids work but don’t match?

This will be the case if either the content id on the page doesn’t match a correct id field in your product file or your using product_group for content_type and don’t have the same id numbers in your item_group_id field.

If you are using “product_group” for your content_type and have the proper ids in the “id” field in your product file you can simply copy those ids into the “item_group_id” field and re-upload your product file.

Once you’ve figured out the problem and have the ViewContent event working you’ll want to repeat these steps to test the AddToCart and Purchase events.

How Can AdShark Marketing Help?

Stuck on a step or confused about how to implement Facebook pixel events on your e-commerce site? Contact us and we can help walk you through the process. We also have experience with advanced targeting ad strategies on Facebook and Instagram and can work with you to develop a custom strategy using dynamic product ads.

AdShark_fin_blue-circle

Ready to grow FASTER? Let's Talk!

Ready to Grow FASTER?

Leave a Comment





Interested in having us help you grow?