Today we are announcing several upgrades to conversion tracking and optimization at Facebook:
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.
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:
<!-- 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>&ev=PageView&noscript=1" /></noscript> <!-- End Facebook Custom Audience Pixel Code -->
<!-- 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 & Accessories > Shoes', content_ids: ['<product_id>'], content_type: 'product', value: 199.50, currency: 'USD' }); </script> <!-- End Custom Audience Pixel Code -->
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
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 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
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
Sign up for monthly updates from Meta for Developers.