skip to Main Content

How to set the gender in Facebook Marketing API targetting spec?

I’ve tried setting the gender but i’m getting gender is not a valid target spec field error.

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

2

Answers


  1. Chosen as BEST ANSWER

    Found it! It should be genders.

    The values are:

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

  2. From https://developers.facebook.com/docs/marketing-api/buying-api/targeting/:

    genders: array

    • 1=male
    • 2=female.
    • Defaults to all.

    For example:

    targeting: {
      genders: [1]
      ...
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search