【问题标题】:facebook ads api - can't add custom tracking specs in an adfacebook ads api - 无法在广告中添加自定义跟踪规范
【发布时间】:2016-08-07 16:54:41
【问题描述】:

我用的是facebook-python-ads-sdk,我关注了官网:

https://developers.facebook.com/docs/marketing-api/tracking-specs#examples

与:

像素跟踪 您可以通过在广告的 tracking_specs 字段中指定跟踪像素来跟踪广告中不同像素的效果。假设您定义:

tracking_specs="[
  {'action.type':'offsite_conversion','fb_pixel':1},
  {'action.type':'offsite_conversion','fb_pixel':2},
  {'action.type':'offsite_conversion','fb_pixel':3}
]"

问题是当我将它添加到广告时,它显示错误为

"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"
      }

我的代码:

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}

当我删除 tracking_specs 时,它可以正常工作。并且我已将像素添加到广告集,它对我来说也可以正常工作。

ad_set[AdSet.Field.promoted_object] = {'pixel_id': 6015522072958}

所以像素id是正确的。

我做错了什么?感谢您的任何回答。

【问题讨论】:

  • 这是一组规格,你试过了吗:ad[Ad.Field.tracking_specs] = [{'action.type': 'offsite_conversion', 'fb_pixel': 6029740175958}]
  • @PaulBain 我试过了,但我得到了同样的错误。

标签: python facebook facebook-ads-api facebook-marketing-api


【解决方案1】:

该死,我向https://graph.facebook.com/2.5/{Ad_ID} 发出了 GET 请求, 我之前在广告中添加了跟踪规范。

然后,我得到了:

"tracking_specs": [
    {
      "action.type": [
        "offsite_conversion"
      ],
      "offsite_pixel": [
        "6015521805358",
        "6015522072958",
        "6029740098558",
        "6029740175958"
      ]
    },
    {
      "action.type": [
        "post_engagement"
      ],
      "page": [
        "380039845369159"
      ],
      "post": [
        "1062663363773467"
      ]
    }
  ],

你注意到区别了吗?

这是 offsite_pixel 字段。 在上面的例子中,它是 fb_pixel。 ¯\(°_°)/¯

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-30
    相关资源
    最近更新 更多