
Hi Quang,
Thank you for reaching out to us. This is Yasmin from the Google Ads Scripts team.
For us to further investigate and better address your issue, it would be highly appreciated if you can provide the following information below:
Kindly send the requested items via `Reply privately to author` option. If the said option is not available on your end, you may send those through this email alias <googleadsscr...@google.com> instead.
Regards,
|
||||||
Hello Quang,
I made a copy of your script and tested it, then I was able to reproduce the same issue on my end. I checked our documentation, and I didn’t see any references for this kind of immutable behavior upon excluding a specific audience on video ad group level. Having said that, I will be raising this issue to our internal for further investigation. Rest assured that someone from our team will get back to you with an update.
Regards,
|
||||||
Hi Quang,
We appreciate your patience. I just heard back from the team regarding this issue.
Upon their investigation, they stated that it looks like you have already included Handbags as a user interest target and want to remove the targeting. But you have written code to create an exclusion rule for Handbags, and you are getting an error because the system interprets this as a request to toggle the positive target to a negative target (which is not allowed).
If you just want to remove all Handbag targeting, you should replace this part of the code snippet:
const operation = videoAdGroup
.videoTargeting()
.newAudienceBuilder()
.withAudienceId(audienceId)
.withAudienceType('USER_INTEREST')
.exclude();
with the following code snippet:
const audiences = videoAdGroup.videoTargeting().audiences().get();
for (const audience of audiences) {
if (audience.getAudienceId() === String(audienceId)) {
audience.remove();
}
}
Additionally, if you would like to toggle the Handbag targeting from a positive target to a negative target, then you should combine the two code snippets together. This will remove the positive target and then create the exclusion rule.
const audiences = videoAdGroup.videoTargeting().audiences().get();
for (const audience of audiences) {
if (audience.getAudienceId() === String(audienceId)) {
audience.remove();
}
}
const operation = videoAdGroup
.videoTargeting()
.newAudienceBuilder()
.withAudienceId(audienceId)
.withAudienceType('USER_INTEREST')
.exclude();
Let us know how it goes over at your end.
Regards,
|
||||||