Home
Blog
Upgrades to Conversion Tracking

June 10, 2015

Upgrades to Conversion Tracking

By Seema Harindran Puthyapurayil

Today we are announcing several upgrades to conversion tracking and optimization at Facebook:

  • In addition to creating website custom audiences, you can now report and optimize for conversions using the Custom Audience pixel. To accomplish this we are launching 9 new standard events, the same standard events used for Dynamic Product Ads and App Events, to report and optimize for conversions.
  • All Facebook pixels are now up to 3X faster. We’ve rewritten a large part of our server response code and used javascript minification so that pixel load times can meet even the most strict customer SLAs.
  • We’ve implemented code versioning for the pixel code.
  • We've enhanced pixel code error reporting and report common errors directly to your browser’s JavaScript console.
  • You can now share your Custom Audience pixel with agencies and other ad accounts through Business Manager.
  • Through a new Custom Audience Pixel Stats API and in Power Editor and Ads Manager we are gradually rolling out a new pixel view and troubleshooting dashboard that allows marketers to get a snapshot of the pixel traffic on their website as well as easy access to tools that can help you create audiences, email pixel code to your developer, and troubleshoot your pixel implementation.
  • In Power Editor, you can now track mobile app events in addition to Conversion and Custom Audience pixel for Website Clicks and Website Conversions objectives.
  • In Power Editor, all the active conversion pixels in an account are automatically selected by default for tracking. You must unselect pixels that you do not want to track.

Your existing conversion and custom audience pixels will continue to work as before, but we recommend advertisers to upgrade to the latest version of the Custom Audience pixel to take advantage of these new features.

To try out the new features in Power Editor and Ads Manager, reach out to your Facebook sales representative.

Upgraded Custom Audience Pixel

If you don't have the Custom Audience pixel you can more about creating the pixel and placing it on your website here.

If you already have the Custom Audience pixel code placed on your website, to migrate to the upgraded Custom Audience Pixel code:

  • Paste the base code below into every page of your website

<!-- Facebook Custom Audience Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
// Insert Your Facebook Pixel ID below. 
fbq('init', '<FB_PIXEL_ID>');
fbq('track', 'PageView');
</script>
<!-- Insert Your Facebook Pixel ID below. --> 
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=<FB_PIXEL_ID>&amp;ev=PageView&amp;noscript=1"
/></noscript>
<!-- End Facebook Custom Audience Pixel Code -->

  • Place one of the 9 standard events on select pages of your website with standard parameters. For example, when someone makes a purchase call the Purchase event on the purchase confirmation page only with information about the order passed back in the standard parameters such as value and currency:

<!-- Facebook Custom Audience Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
// Insert Your Custom Audience Pixel ID below. 
fbq('init', '<FB_PIXEL_ID>');
fbq('track', 'PageView');
// Replace the values for the parameters below with actual values of the purchase
fbq('track', 'Purchase', {
content_name: 'Really Fast Running Shoes',
content_category: 'Apparel &amp; Accessories > Shoes',
content_ids: ['<product_id>'],
content_type: 'product',
value: 199.50,
currency: 'USD'
});
</script>
<!-- End Custom Audience Pixel Code -->

  • After you have placed the upgraded Custom Audience pixel code remove the existing Custom Audience pixel from your website.

Reporting Conversions from the upgraded Custom Audience pixel

To report a conversion from the Custom Audience pixel you must first add standard events to the Custom Audience pixel base code as described in step 2 above.

Next, set the tracking specs to track the Custom Audience pixel on the ad group like this:

curl \
-F "campaign_id=<AD_SET_ID>" \
-F "targeting={'countries':['US']}" \
-F "creative={creative_id:<CREATIVE_ID>}" \
-F "name=Example ad" \
-F "tracking_specs=[{'action.type':'offsite_conversion','fb_pixel':<fb_pixel_id>}]" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adgroups"

Now you can pull a report of all Purchase attributed to Facebook ads:

curl -G \
-d "date_preset=last_3_months" \
-d "filtering=[{'field':'action_type','operator':'EQUAL','value':'offsite_conversion.fb_pixel_purchase'}]" \
-d "access_token=<ACCESS_TOKEN>" \
https://graph.facebook.com/<API_VERSION>/<ADGROUP_ID>/insights

Read more about reporting conversions from the Custom Audience pixel here

Optimizing for Conversions using the Custom Audience pixel

You can even optimize for conversions using standard events. From 2.3 onwards, you can set the promoted_object at the ad set level to your upgraded Custom Audience pixel id and optimize for a specific standard event. The conversion_specs will be automatically inferred from the objective and the promoted_object.

curl \
-F "name=Ad Set oCPM" \
-F "bid_type=ABSOLUTE_OCPM" \
-F "bid_info={'ACTIONS':150}" \
-F "campaign_status=PAUSED" \
-F "promoted_object={'pixel_id':<FB_PIXEL_ID>, 'custom_event_type':'PURCHASE'}" \
-F "daily_budget=1000" \
-F "campaign_group_id=<CAMPAIGN_ID>" \
-F "targeting=<TARGETING>" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adcampaigns"

If you are using version 2.2 of the API you can learn how to set conversion_specs and promoted_object here

Using the Custom Audience Pixel Stats API

Using the new Custom Audience Pixel stats API you can get basic information about the pixel traffic on a website. For example, you can view all the urls and how many times they were accessed between two dates:

curl \
-F 'access_token=<ACCESS_TOKEN>' \
-F 'aggregation=url' \
-F 'start_time=1402920000' \
-F 'end_time=1403032284' \
'https://graph.facebook.com/<pixel_id>/stats'

Response:

"data": [
{
"aggregation": "url", 
"timestamp": "2014-06-16T13:00:00", 
"data": [
{
"value": "http://www.example.com/property/details.html", 
"count": 65029
}, 
{
"value": "http://www.example.com/search/search.html", 
"count": 33213
}, 
{
"value": "http://www.example.com/mobile/search.html", 
"count": 30434
}, 
{
"value": "http://www.example.com/search.do", 
"count": 30089
}, 
{
"value": "http://www.example.com/mobile/someDetails.html", 
"count": 12966
}, 
{
"value": "http://uk.example.com/product/details.html", 
"count": 11590
}, 
...

Read more about the Pixel Stats API here

Sharing a Custom Audience pixel

With the new sharing functionality in Business Manager you can share a pixel with other ad accounts you own or with other businesses. To share your pixel with your marketing partner's or agencies business:

curl \
-F "business=<YOUR_BUSINESS_ID>" \
-F "agency_id=<AGENCY_BUSINESS_ID>" \
-F "access_token=<ACCESS_TOKEN>" \
https://graph.facebook.com/<API_VERSION>/<PIXEL_ID>/shared_agencies

Read more about the upgrades to the Custom Audience pixel, including how to implement the new standard events for conversion reporting and optimization here:


TAGS