News for Developers

Back to News

Dynamic Targeting with Campaign/Ad Set Conversion Lookalike Audience

Related News

MPA

September 12 2017

Simplifying Ad Creation

December 18 2014

Ads API V2.2 Schedule

December 16 2014

Dynamic Targeting with Campaign/Ad Set Conversion Lookalike Audience

When you find a certain targeting combination that works well for your ads, you may like to make a lookalike audience on top of it for using in targeting for other campaigns. In the past, you can create lookalike audiences based on your own custom audience, users tracked by certain conversion pixels, or users who like your Page.

Now, Facebook has introduced a new kind of lookalike: campaign/ad set conversion lookalike. You can create a lookalike audience based on the converters in ad campaigns and/or ad sets.

With the new campaign/ad set conversion lookalike audience, you can use the converters of your current campaign/ad set to improve itself by using it as the seed of your current campaign/ad set. As Facebook will keep updating the underlying prediction model as these campaigns or ad sets get newer converters, the lookalike audience expands itself during the process. The flow is now changed to conversions →lookalike audiences →more conversions→more lookalike audiences, a self-improving loop.

To create a campaign using dynamic targeting, you should do these:

  1. Create a campaign.
  2. Create a pilot ad set with your best targeting strategy so far, with a small portion of your budget, and get at least 100 converters, ideally more than 200.
  3. Create a second set with the remaining main part of your budget.
  4. Create a campaign/ad set conversion lookalike audience, using both those two ad sets.
  5. Update the second ad set's targeting with this lookalike audience.

The following example codes using Facebook PHP Ads API SDK or Python Ads API SDK do exactly this job, assuming the pilot ad set has collection a reasonable amount of converters already:

use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\LookalikeAudience;
use FacebookAds\Object\Fields\LookalikeAudienceFields;

// Step 1, create a campaign. Assuming done already.
$campaign_id = <CAMPAIGN_GROUP_ID>;

// Step 2, create a pilot ad set and run it. Assuming that this is done,
// and this adset has at least 100, ideally over 200 convertors
$pilot_adset_id = <PILOT_ADSET_ID>; 
$adaccount_id = 'act_<AD_ACCOUNT_ID>';

// Step 3, create a second ad set with the remaining main part of your budget.
$data = array(
AdSetFields::NAME => 'My AdSet',
AdSetFields::BID_TYPE => 'CPA',
AdSetFields::BID_INFO => array(
'ACTIONS' => 500,
),
AdSetFields::PROMOTED_OBJECT => array(
'page_id' => <PAGE_ID>,
),
AdSetFields::CAMPAIGN_STATUS => AdSet::STATUS_PAUSED,
AdSetFields::DAILY_BUDGET => 20000,
AdSetFields::CAMPAIGN_GROUP_ID => $campaign_id,
AdSetFields::TARGETING => array(
'geo_locations' => array(
'countries' => array(
'US',
),
),
),
);
$ad_set = new AdSet(null, $adaccount_id);
$ad_set->create($data);
$adset_id = $ad_set->id;

// Step 4, create a campaign/ad set conversion lookalike audience, using 
// both those two ad sets.
$lookalike = new LookalikeAudience(null, $adaccount_id);
$lookalike->{LookalikeAudienceFields::LOOKALIKE_SPEC} = array(
'origin_ids' => array($pilot_adset_id, $adset_id),
'ratio' => 0.05,
'conversion_type' => 'campaign_conversions',
'country' => 'US',
);
$lookalike->create();
$lookalike_id = $lookalike->id;

//Step 5, update the second ad set's targeting with this lookalike audience.
$ad_set->campaign_status = AdSet::STATUS_ACTIVE;
$ad_set->targeting = array(
'geo_locations' => array(
'countries' => array(
'US',
),
),
'custom_audiences' => array(
array(
'id' => $lookalike_id,
) 
),
),
$ad_set->update();
from facebookads.objects import AdSet, LookalikeAudience

# Step 1, create a campaign. Assuming done already.                                
campaign_id = <CAMPAIGN_GROUP_ID>;                                                  

# Step 2, create a pilot ad set and run it. Assuming that this is done,
# and this adset has at least 100, ideally over 200 convertors                                          
pilot_adset_id = <PILOT_ADSET_ID>;                                                  
adaccount_id = 'act_<AD_ACCOUNT_ID>';                                              

# Step 3, create a second ad set with the remaining main part of your budget.            
adset = AdSet(parent_id=adaccount_id)                                              
fields = {                                                                      
AdSet.Field.name: 'My AdSet',                                                  
AdSet.Field.bid_type: 'CPA',                                        
AdSet.Field.bid_info: {                                                        
'ACTIONS': 500,                                                                
}, 
AdSet.Field.promoted_object: {
'page_id': <PAGE_ID>,
}
AdSet.Field.status: AdSet.Status.paused,                                        
AdSet.Field.daily_budget: 20000,                                                
AdSet.Field.campaign_group_id: campaign_id,                                    
AdSet.Field.targeting: {                                                        
'geo_locations': {                                                            
'countries': ['US'],                                                        
},                                                                            
},                                                                              
}
adset.update(fields)
adset.remote_create()                                                              

# Step 4, create a campaign/ad set conversion lookalike audience, using            
# both those two ad sets.                                                          
lookalike = LookalikeAudience(parent_id=adaccount_id)
params = {                                                                 
LookalikeAudience.Field.lookalike_spec = {                                      
'origin_ids': [pilot_adset_id, adset[AdSet.Field.id]],                      
'ratio': 0.05,                                                              
'conversion_type': 'campaign_conversions',                                  
'country': 'US',                                                            
},     
}
lookalike.update(params)                                                                                  
lookalike.remote_create()                                                          

# Step 5, update the second ad set's targeting with this lookalike audience.        
adset[AdSet.Field.status] = AdSet.Status.active
custom_audience = {'id': lookalike[Lookalike.Field.id]}
adset[AdSet.Field.targeting] = {                                                    
'geo_locations': {                                                              
'countries': ['US'],                                                        
},                                                                              
'custom_audiences': [custom_audience],                                                                            
}                                                                                  
adset.remote_update()


Related News

September 12 2017

December 18 2014

December 11 2014

December 02 2014

November 13 2014