문제

We have many accounts we manage and the ones we are interested have the label 'Active Clients'. This label is shown on the first page of the MCC ('My Client Center') in the table. It is the second column of the table that shows 'Labels'.

Here's the basic script:

function main() {

  var accountSelector = MccApp.accounts()
  .withCondition("Labels = 'Active Clients'");

  var accountIterator = accountSelector.get();

  // Iterate through the list of accounts
  while (accountIterator.hasNext()) {
  var account = accountIterator.next();

  // Select the client account.
  MccApp.select(account);

  // Operate on client account
  Logger.log('Customer ID: ' + account.getCustomerId() );
  }

}

This is how I'm trying to iterate through all clients that have the label 'Active Clients'. It doesn't work and I'm wondering if it can be made to work or I must specify the id's of all clients.

도움이 되었습니까?

해결책

The column name is LabelNames instead of Labels. Also its type is StringSet, not String, so you should use .withCondition("LabelNames CONTAINS_ANY ['Active Clients']"). However, "LabelNames" is not an available column for AccountSelector conditions yet (https://developers.google.com/adwords/scripts/docs/reference/mccapp/mccapp_accountselector#withCondition_1), hope this will change by time.

Anyway, I recommend to create a new MCC, where you keep only active clients, so you can place the script there without using withCondition.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top