I am trying to create an ad using the Facebook Marketing API. In order to create an ad inside a conversion based campaign, I am required to set proper tracking_specs
values.
Querying existing ads (on other similar campaigns) I see the tracking spec is generally defined as follows:
"tracking_specs": [
{
"action.type": ["offsite_conversion"],
"fb_pixel": [<pixel ID>]
},
{
"action.type": ["post_engagement"],
"page": [<page ID>],
"post": [<post ID>]
},
{
"action.type": ["link_click"],
"post": [<post ID>],
"post.wall": [<post.wall ID>]
}
]
How do I find the required tracking_specs
values? More specifically, how do I find the post
ID and the post.wall
ID accordingly for post_engagement
and link_click
action types?
2
Answers
I managed to figure it out on my own. When creating a new ad, in a conversion typed campaign, an ad data object that includes tracking specs should be provided. These tracking specs should include some reference to a Facebook pixel.
The pixels data can be obtained manually via the Facebook Business Manager or via the Facebook Marketing APIs:
Read more in https://developers.facebook.com/docs/marketing-api/reference/ad-account/adspixels/
Regarding the
post
andpost.wall
IDs - these are automatically added by Facebook when the ad is created. So there is no need to include theses when creating the ad.For anyone searching for an answer in 2023. asaf’s answer is totally correct BUT you also need to wait until Meta Business Manager processes your campaign in order to see
tracking_specs
into the API and in the Business Manager itself.