Build audiences based on peoples' actions in your app that meet your criteria. This feature allows you to build an audience who, for example:
This solution uses logged named events through our Facebook SDKs, App Events API, or via Mobile Measurement Partners. Examples of events to log include "Installed", "Added to Cart", "Purchased", or "Achieved a Level".
subtype
for engagement custom audiences is only supported for video.POST /{ad-account-id}/adsets
endpoint for iOS 14.5 SKAdNetwork campaigns. To create Custom Audiences from your mobile app, the ad account must accept the Terms of Service for Custom Audiences, in Ads Manager. To sign the terms:
To create your audience:
curl -X POST \
-F 'name="My Test Website Custom Audience"' \
-F 'rule={
"inclusions": {
"operator": "or",
"rules": [
{
"event_sources": [
{
"id": "<APP_ID>",
"type": "app"
}
],
"retention_seconds": 8400,
"filter": {
"operator": "and",
"filters": [
{
"field": "event",
"operator": "eq",
"value": "fb_mobile_purchase"
}
]
}
}
]
}
}' \
-F 'prefill=1' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0/act_<AD_ACCOUNT_ID>/customaudiences
This returns the id
of the audience upon success. These parameters are most relevant:
Name | Description |
---|---|
type: String | Required. Name of your custom audience. |
type: String | Optional. Description of your custom audience. |
type: JSON object | Optional. Rule to define the audience. See Audience Rules. |
Each ad account can create a maximum of 200
custom audiences via Custom Audiences from Your Mobile App. Make a POST
request to:
https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/customaudiences
Use these fields:
Name | Description |
---|---|
type: string | Required. Name of your Custom Audience |
type: integer | Required. How long someone is in this audience. The minimum number is If |
type: JSON Object | Required. Rules to define the audience. See Audience Rules |
To determine who gets added to the Custom Audience, define a rule based on events in your app. A rule is a JSON object with key-value pairs and can reference multiple app events. You can define the rule based on specific events and their parameters and also the aggregation. See Audience Rules for more information. See also:
event_sources
, set id
to your app's ID and type
to app
.'event'
as field
, if the filter is to specify an event. Parameters that match App events sent by app; for example, "_appVersion", "_value", and so on.field
attribute is set to "event"
, the value must be set to an event name. Use the App Event API to see app events and parameters reported by the pixel."count"
,"sum"
, "avg"
, "min"
, and "max"
.All mobile app purchasers in the last 30 days for app id 55064006
:
{ "inclusions: { "operator": "or", "rules": [ { "event_sources": [ { "id": 55064006, "type": "app" } ], "retention_seconds: 2592000, "filter": { "operator": "and", "filters": [ { "field": "event", "operator": "=", "value": "fb_mobile_purchase" } ] } } ] } }
All users who passed back custom “timeOnPanel”
events in the last 30 days for app id 55064006
:
{ "inclusions: { "operator": "or", "rules": [ { "event_sources": [ { "id": 55064006, "type": "app" } ], "retention_seconds: 2592000, "filter": { "operator": "and", "filters": [ { "field": "event", "operator": "=", "value": "timeOnPanel" } ] } } ] } }
All users who passed back custom “timeOnPanel”
events where event value is greater than 30, color is “red”
or “blue”
, and favorite dessert contains “banana”
:
{ "inclusions: { "operator": "or", "rules": [ { "event_sources": [ { "id": 55064006, "type": "app", } ], "retention_seconds: 2592000, "filter": { "operator": "and", "filters": [ { "field": "event", "operator": "=", "value": "timeOnPanel", }, { "field": "_value", "operator": ">", "value": 30, }, { "field": "color", "operator": "is_any", "value": ["red", "blue"], }, { "field": "favoriteDessert", "operator": "contains", "value": "banana", } ] } } ] } }
Top 20% purchasers based on the purchases in the last 30 days:
{ "inclusions: { "operator": "or", "rules": [ { "event_sources": [ { "id": 55064006, "type": "app" } ], "retention_seconds: 2592000, "filter": { "operator": "and", "filters": [ { "field": "event", "operator": "=", "value": "fb_mobile_purchase" } ] } "aggregation": { "type": "count", "method": "percentile", "operator": "in_range", "from": 75, "to": 100, } } ] } }
The following example includes people who added to cart, but not purchased:
{ "inclusions: { "operator": "or", "rules": [ { "event_sources": [ { "id": 55064006, "type": "app" } ], "retention_seconds: 2592000, "filter": { "operator": "and", "filters": [ { "field": "event", "operator": "=", "value": "add_to_cart" } ] } } ] }, "exclusions": { "operator": "or", "rules": [ { "event_sources": [ { "id": 55064006, "type": "app" } ], "retention_seconds: 2592000, "filter": { "operator": "and", "filters": [ { "field": "event", "operator": "=", "value": "fb_mobile_purchase" } ] } } ] } }
Query which app events and parameters an app reported to Facebook. You can use these events and parameters directly for creating Custom Audiences. You need an access token associated with the app_id
with a admin, developer, or advertiser role.
Make a GET
request:
https://graph.facebook.com/<API_VERSION>/<APP_ID>/app_event_types
The response is JSON containing a data
array of JSON dictionaries having these fields:
Name | Description |
---|---|
type: string | App event type to use in rule. |
type: string | Human-readable name of event type |
type: string | Verbose description of standard event |
type: array | array of JSON dictionaries describing parameters for this event
|