Gender targeting "Expected Long"


#1

Hi,

I am having trouble assigning gender targeting to a line item. According to the documentation, the gender parameter accepts “a comma-separated string of gender identifiers to scope targeting to on this line item.” However, when I send a request with gender: '1,2', it returned a validation error "Expected Long, got “1,2”.

Could you please advise? Thanks!

line_item_id: '4hy8i’
expected result: successful with the targeting criteria as response
actual result: {“errors”:[{“code”:“INVALID_PARAMETER”,“message”:“Expected Long, got “1,2” for gender”,“parameter”:“gender”}]

twurl example:

<=== [2016-03-01 16:45:12 +0000 :: ouyhz0t10 :: 67cm :: 1851862034] twurl -H ads-api.twitter.com -X PUT -d “line_item_id=4hy8i&broad_keywords=starbucks,tim+hortons,second+cup&exact_keywords=&phrase_keywords=&negative_exact_keywords=&negative_unordered_keywords=mcdonalds,burger+king,kfc&locations=0192e4d84ed0ea4e&interests=&gender=1,2&followers_of_users=&similar_to_followers_of_users=&platform_versions=&devices=&wifi_only=&tv_shows=&tailored_audiences=&tailored_audiences_expanded=&tailored_audiences_excluded=&behaviors=&behaviors_expanded=&negative_behaviors=&languages=&network_operators=&app_store_categories=&campaign_engagement=&user_engagement=1851862034&engagement_type=VIDEO_VIEW_PARTIAL” “/0/accounts/18ce53uuf0f/targeting_criteria”

===> [2016-03-01 16:45:13 +0000 :: ouyhz0t10 :: 67cm :: 400 Bad Request :: 0.34s :: 291/300 (…1s)] {“errors”:[{“code”:“INVALID_PARAMETER”,“message”:“Expected Long, got “1,2” for gender”,“parameter”:“gender”}],“request”:{“params”:{“locations”:“0192e4d84ed0ea4e”,“tv_shows”:"",“line_item_id”:“4hy8i”,“tailored_audiences_excluded”:"",“tailored_audiences_expanded”:"",“tailored_audiences”:"",“similar_to_followers_of_users”:"",“behaviors_expanded”:"",“exact_keywords”:"",“app_store_categories”:"",“negative_unordered_keywords”:“mcdonalds,burger king,kfc”,“campaign_engagement”:"",“account_id”:“18ce53uuf0f”,“languages”:"",“network_operators”:"",“broad_keywords”:“starbucks,tim hortons,second cup”,“negative_exact_keywords”:"",“interests”:"",“engagement_type”:“VIDEO_VIEW_PARTIAL”,“behaviors”:"",“followers_of_users”:"",“user_engagement”:“1851862034”,“wifi_only”:"",“platform_versions”:"",“phrase_keywords”:"",“devices”:"",“negative_behaviors”:""}}}


#2

Hi @etam. Why would you send both genders since this is the default? I think Twitter is expecting only a 1, or 2 for gender, even if they say that this is a “comma-separated string of identifiers” (so this is wrong, actually). You should only set the gender parameter if you want to limit targeting to only males or only females. The page https://dev.twitter.com/ads/campaigns/targeting seems to get this right:

Gender: Target males (1) or females (2). Leave null to target all.


#3

In that case, how do you target males and females while excluding the non-gender specific audiences?


#4

Can you provide more detail in an example?

Thanks!


#5

@etam: I guess there’s no way to do that on Twitter.


#6

On Twitter there are 3 types of users in terms of gender - male, female and there are some users that did not specify a gender. In order to exclude the non-gender specific users, we have been sending male and female (“1,2” in the gender parameter). We have been doing this for quite a long time, and the Twitter documentation also mentioned that it accepts a comma separated string instead of, what the exception described, a Long.


#7

I see, I guess something changed then. In the Ads UI, though, there is no way of excluding those that did not specify a gender; you only have 3 possibilities: All, Males, Females. So I guess the API only mirrors (now) what is in the UI.


#8

Hi Edward,

Sorry for not understanding earlier. I’m not familiar with what the functionality used to be, and I apologize if it has changed. I’ll raise it to the team and see what they say.

The docs and code don’t specifically denote there being a way to target non-gender specified users – a “3” if you will. So my guess is that that functionality has not been possible.

Curious: what is the marketing or business case for specifically targeting people who have not specified their gender?


#9

Hey Ryan,

Thanks for clarifying! I wanted to make sure that this is now the correct behaviour (selecting male (1), female (2), or all (null)) so that we can make the appropriate changes on our end.

Historically we have been able target specifically users who have identified as “Male” or “Female”, so that we are effectively excluding non-gender specified users. We did this by specifying “gender=1,2” for the gender field as shown in the twurl above - however it appears the API has changed recently as we are now no longer able to pass in multiple values for gender targeting. We are NOT trying to explicitly target non-gender specific users.

Thanks.


#10

That is the current correct behavior. I will note this possible change in behavior to the eng team, but I would imagine that an update on your site is likely the fastest for your own users.

Apologies again, and thanks for inquiring!


#11