How to add age, gender into the Video Ad Group via the Google Ads Script

75 views
Skip to first unread message

Ashish Chaturvedi (Ashu)

unread,
Jul 5, 2023, 12:25:54 AM7/5/23
to Google Ads Scripts Forum
I have a question regarding targeting for the video campaign,

Why isn't this code working? There are no errors during execution, but the target is not being reflected in the Adgroup.

try {
var videoAgeBuilder = videoAdGroup.videoTargeting().newAgeBuilder();
var videoAgeOperation = videoAgeBuilder
.withAgeRange('AGE_RANGE_25_34') // required
.build();
} catch (errorAdGroupAgeBuilder) {
console.log('Ad Group Age Builder failed to be created: ' + errorAdGroupAgeBuilder.message);
}



try {
var videoGenderBuilder = videoAdGroup.videoTargeting().newGenderBuilder();
var videoGenderOperation = videoGenderBuilder
.withGenderType('FEMALE') // required
.build(); // create the gender
} catch (errorAdGroupGenderBuilder) {
console.log('Ad Group Gender Builder failed to be created: ' + errorAdGroupGenderBuilder.message);
}


try {
var videoAudienceBuilder = videoAdGroup.videoTargeting().newAudienceBuilder();
var videoAudienceOperation = videoAudienceBuilder
.withAudienceType('CUSTOM_AFFINITY') // required
.withAudienceId(91907) // required
.build();
} catch (errorAdGroupAudienceBuilder) {
console.log('Ad Group Audience Builder failed to be created: ' + errorAdGroupAudienceBuilder.message);
}

Google Ads Scripts Forum

unread,
Aug 2, 2023, 8:19:18 AM8/2/23
to Google Ads Scripts Forum
Reposting the last inquiry (https://groups.google.com/g/adwords-scripts/c/CgZQ8TwlSRI) from the forum as it wasn't routed to our support queue.

Regards,
Google Ads Scripts Support Team

Google Ads Scripts Forum

unread,
Aug 2, 2023, 8:22:38 AM8/2/23
to Google Ads Scripts Forum
Hi Ashish,

Thank you for reaching out to the Google Ads Scripts Support Team. Please excuse us for only getting back now as your message failed to be routed to our support queue.

Could you please confirm if you ran the script as opposed to previewing <https://developers.google.com/google-ads/scripts/docs/concepts/preview> it? When scripts are executed in preview mode, they make no changes to the actual data in your account. Instead, script execution shows the changes that would have been made had the script been executing. Once satisfied with the output, you can start the live execution of your script or schedule it.

If that is not the case, kindly provide the following information so we're able to investigate this further:
  • Google Ads account ID
  • Name of the script in the account

Best regards,

Google Ads Scripts Support Team
Reply all
Reply to author
Forward
0 new messages