Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sollicitudin, tellus vitae condimentum egestas, libero dolor auctor tellus, eu consectetur neque.

How to Set Up Dynamic E-Commerce Tracking in Facebook Ads

How to Set Up Dynamic E-Commerce Tracking in Facebook Ads

How to Set Up Dynamic E-Commerce Tracking in Facebook Ads

Facebook is still the most-used social media platform on the planet. But, keep in mind that Facebook is much more than a social platform; it’s a vast tool that uses a plethora of different variables to optimize social media advertising campaigns–specifically dynamic e-commerce tracking.

Despite its importance, dynamic e-commerce tracking in Facebook ads is tragically under-utilized. So, today, we’re going to explain why it’s so important to every e-commerce Facebook campaign, and how you can jumpstart implementation.

Running an e-commerce Facebook campaign? You need tracking capabilities. Always.

Facebook’s elaborate targeting and e-commerce tracking capabilities allow social advertisers to peer inside the minds of our customers in a far more intimate way than traditional advertising could never do. Why not take advantage of that?

That said, let me reiterate: setting up dynamic e-commerce tracking is essential to great Facebook campaigns. The more data that Facebook has, the better the optimization. And how does Facebook do that?

Simple: snippets of code that you can add to virtually every action on your website–from CTA’s to page views. Pulling those events into Facebook lets Facebook optimize its ad delivery to people more likely to complete the action (e.g. visit your website, purchase a product, etc.).

Pulling dynamic product values for Facebook Events

Disclaimer: This article is assuming you have already installed your Facebook pixel on your website to fire off on page loads. 

Event codes are snippets that are attached to actions on your website. The placement of your event code depends on what type of action is taking place: when a page is viewed or when an action occurs.

Your Facebook Pixel will take care of page load tracking in the header of your website. However, the more complicated, yet more valuable method of tracking, is tracking event actions on your site.

Track events on inline actions

This event is shot off when an inline action occurs. So for example, let’s say a customer clicks a “Submit Order” button in their shopping cart. In this instance, you would add the following code to the HTML element on the site (the button):

<!– The below method uses jQuery, but that is not required –>
<button id=”addToCartButton”>Add To Cart</button>
<!– Add event to the button’s click handler –>
<script type=”text/javascript”>
$( ‘#addToCartButton’ ).click(function() {
fbq(‘track’, ‘AddToCart’, {
content_ids: [‘xxxx’],
content_type: ‘product’,
value: x.xx,
currency: ‘USD’
});
});
</script>

**Notice: DO NOT insert the event code inside the <head> tags.

Dynamic Conversion Values

Dynamic conversion values are what you need to get sales from ads into your Facebook ads account. You need to dynamically pass the value of a purchase in place of the actual dollar amount. For context, just refer to the “value: x.xx” section of the event in the example above.

The variable of value associated with purchases varies depending on which e-commerce platform you’re on and how you (or your developer) set it up.

Here are examples of common e-commerce platform values:

Shopify

‘{{ total_price | money_without_currency }}’,’currency’:’USD’

WooCommerce

<?php echo $order->get_order_total(); ?>

BigCommerce

%%ORDER_SUBTOTAL%%;

Magento

<?php echo $amount; ?>

Squarespace

{orderGrandTotal}

Standard events every e-commerce platform should have setup in Facebook Ads

View Content

The view content event code should be inserted into any product pages to track when users hit them. Product details should be added to dynamically target people who have viewed product pages and optimize ad delivery to drive conversions (purchases).

<script>
fbq(‘track’, ‘ViewContent’, {
content_ids: [‘xxxx’],
content_type: ‘product’,
value: x.xx,
currency: ‘USD’
});
</script>

Add to Cart

This event does what it says: tracks when someone adds an item to their shopping cart. Tracking this event allows you to see who fell off through your purchase funnel, and retarget them with ads to drive them to convert (purchase).

<script>
fbq(‘track’, ‘AddToCart’, {
content_ids: [‘xxxx’, ‘xxxx’, ‘xxxx’],
content_type: ‘product’,
value: x.xx,
currency: ‘USD’
});
</script>

Initiate Checkout

The “initiate checkout” event should be triggered when a person first enters the checkout process. This can be used to track the people who started the checkout process but didn’t actually complete it.

<script>
fbq(‘track’, ‘InitiateCheckout’);
</script>

Add Payment Info

The add payment event should be fired off when a person adds payment information to an account or in the checkout process.

<script>
fbq(‘track’, ‘AddPaymentInfo’);
</script>

Purchase Event

Finally, end of the line–the holy grail of Facebook events. The purchase event is fired off when the order is completed. This is generally added to the “Checkout” button. When a user clicks that button Facebook gets alerted that the purchase has occurred. This is also the most important event to make sure you have dynamic values added to so you can track sales attributed to your ads

When a user clicks that button, Facebook gets alerted that the purchase has occurred. This is also the most important event to make sure you have dynamic values added to so you can track sales attributed to your ads

The purchase event is fired off when the purchase is completed. This is generally added to the “Checkout” button, so when a user clicks that button, Facebook gets an alert that the purchase occurred. This is also the most important event to make sure you have dynamic values.

added to so you can track sales attributed to your ads.

<script>
fbq(‘track’, ‘Purchase’, {
content_ids: [‘xxxx’, ‘xxxx’, ‘xxxxx’],
content_type: ‘product’,
value: xxx.xx,
currency: ‘USD’
});
</script>

Moral of the story

While getting these events setup is somewhat of an overhaul, this is crucial to getting optimal Facebook Ads campaigns and a great asset to keep reporting on ad performance from driving you insane.

Do yourself a favor and get those pesky snippets added to your site.

Or, make your life easier and reach out to Marketing Supply so we can set up your tracking, analytics, or even run your social advertising campaigns.

Nick Bond

1 Comment

  • Mario

    Reply July 19, 2017 2:05 am

    Wow that was strange. I just wrote an extremely long comment but after I clicked submit my comment didn’t appear.
    Grrrr… well I’m not writing all that over again. Anyways, just
    wanted to say fantastic blog!

Post a Comment