Hi there,
I'm trying to update bids for in-market audiences using a script. I have the list of audience IDs for IMAs and am trying to select a single audience via its ID. The clearest way to do this seems to be by using audienceSelector.withIds(), however I'm having trouble getting the selector to return any audiences at all. According to the
documentation, withIds() takes a 1-dimensional array of IDs, so my code looked like this:
var audiences = campaign.targeting().audiences().withIds([audienceCode]).get();
However I got an error that "Each id must be a 2-element array." (similar to other audiences, but not matching the documentation above). So I've tried the following:
var audiences = entity.targeting().audiences().withIds([[campaign.getId(), audienceCode]]).get();
But that is still returning zero audiences. In all cases I've tried explicitly casting IDs to strings and integers but it hasn't had an effect. The audiences are definitely already applied, both in the interface and by iterating all audiences on the campaign and logging their IDs (iterating through all applied audiences unfortunately doesn't mesh with the workflow I'm trying to achieve here, so isn't a viable alternative option).
Any comments on what could be going wrong would be appreciated!