按性别对targets_spec进行过滤

问题描述 投票:0回答:2

如何在Facebook Marketing API定位规范中设置性别?

我已尝试设置性别但我得到的性别不是有效的目标规范字段错误。

targeting_spec = {"geo_locations":
                {
                    "location_types": ["recent"],
                    "custom_locations": [
                        {
                            "latitude": 14.5764,
                            "longitude": 121.0851,
                            "radius": 17
                        }
                    ]
                },
                "age_min": 18,
                "age_max": 35,
                "gender": "male", // Setting gender, doesn't work
                "flexible_spec": [
                    {
                        "interests": [
                            {"id": "6002998074973", "name": "BTS"}
                        ]
                    },
                    {
                        "interests": [
                            {"id": "6005882720291", "name": "Data Science"}
                        ]
                    }
                ]
             }
facebook facebook-marketing-api
2个回答
0
投票

找到了!它应该是性别。

价值观是:

gender: [0] # All
gender: [1] # Men
gender: [2] # Women

0
投票

来自https://developers.facebook.com/docs/marketing-api/buying-api/targeting/

性别:阵列

  • 1 =男
  • 2 =女性。
  • 默认为全部。

例如:

targeting: {
  genders: [1]
  ...
© www.soinside.com 2019 - 2024. All rights reserved.