I′m trying to create a Custom Audience on Facebook′s Conversion API following this guide:
https://developers.facebook.com/docs/marketing-api/audiences/guides/audience-rules
Ive got my data on a JSON:
const rule = {
"inclusions": {
"operator": "or", // Required. and or or.
"rules": [{
"retention_seconds": 3500, //Required. Integer (in seconds) for the retention window of the audience. Min=1; Max=365 days
"event_sources": [{
"id": "<OFFLINE_EVENT_SET_ID>",
"type": "offline_events"
}],
"filter": {
"operator": "and", // Required. and or or.
"filters": [{
"operator": "=", //If field set to event, must use =.
"field": "event", //event
"value": "purchase"
},
{
"operator": ">",
"field": "value",
"value": "50"
}
]
}
}]
}
}
const audienceData = {
"name": "Customs",
"rule": rule,
"access_token": access_token
}
Pushing it with axios:
async function CustomAudience(audience) {
try {
return await axios.post(`https://graph.facebook.com/${api_version}/${audienceID}/users`, audience);
} catch (error) {
console.error(error);
}
}
customAudience(audienceData);
I know i can do it with offline conversions, (among other things, because it gives me the option on field)
For Store Visits Custom Audiences, use 'event' or store_visit_country.
My question is regarding "retention seconds"
as they are offline conversions, I do not have retention_seconds, and according to the documentation, they are required, and I can not modify my JSON data, as it comes from a CRM.
And when you do a Custom Audience manually, you do not have to specify retention_seconds...
What is the best practice here? Re build a JSON and add a fake retention_seconds seems dirty, but its a required field...
question from:
https://stackoverflow.com/questions/65930117/facebook%c2%b4s-conversion-api-custom-audience 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…