Reputation: 592
I'm using facebook-python-ads-sdk,and i have followed the official site:
https://developers.facebook.com/docs/marketing-api/tracking-specs#examples
with:
Pixel Tracking You can track the performance of different pixels in an ad by specifying the tracking pixel in the ad's tracking_specs field. Let's say that you define:
tracking_specs="[
{'action.type':'offsite_conversion','fb_pixel':1},
{'action.type':'offsite_conversion','fb_pixel':2},
{'action.type':'offsite_conversion','fb_pixel':3}
]"
The problem is when I added it to an ad,it shows me the error as
"error": {
"code": 100,
"is_transient": false,
"error_subcode": 1634019,
"error_user_msg": "Please check that a valid and non-empty object id is passed in.",
"error_user_title": "The id of the object (post, page, etc) passed in is invalid.",
"message": "Invalid parameter",
"type": "FacebookApiException",
"fbtrace_id": "HhCZrs9+8GH"
}
my code:
ad = Ad(parent_id=account_id)
ad[Ad.Field.name] = ad_name
ad[Ad.Field.adset_id] = adset_id
ad[Ad.Field.tracking_specs] = {'action.type': 'offsite_conversion', 'fb_pixel': 6029740175958}
when i removed the tracking_specs,it works fine.And i have added the pixel to adset,it also works fine to me.
ad_set[AdSet.Field.promoted_object] = {'pixel_id': 6015522072958}
So the pixel id is correct.
What am I doing wrong?Thanks for any answer.
Upvotes: 0
Views: 1456
Reputation: 592
Damn it, i made a GET request to https://graph.facebook.com/2.5/{Ad_ID}, i have added tracking specs to the Ad before.
And then,i got:
"tracking_specs": [
{
"action.type": [
"offsite_conversion"
],
"offsite_pixel": [
"6015521805358",
"6015522072958",
"6029740098558",
"6029740175958"
]
},
{
"action.type": [
"post_engagement"
],
"page": [
"380039845369159"
],
"post": [
"1062663363773467"
]
}
],
Did you notice the difference?
It is the offsite_pixel field. In the above example,it was fb_pixel. ¯\(°_°)/¯
Upvotes: 0