AdsApp.​LanguageSelector

Fetches languages. Supports filtering and sorting.

Typical usage:

 var languageSelector = campaign.targeting()
     .languages()
     .withCondition("Impressions > 100")
     .orderBy("Clicks DESC");

 var languageIterator = languageSelector.get();
 while (languageIterator.hasNext()) {
   var language = languageIterator.next();
 }
Related:

Methods:

MemberTypeDescription
get AdsApp.LanguageIterator Fetches the requested languages and returns an iterator.
withIds AdsApp.LanguageSelector Restricts this selector to return only languages with the given language IDs.
withLimit AdsApp.LanguageSelector Specifies limit for the selector to use.

get()

Fetches the requested languages and returns an iterator.

Return values:

TypeDescription
AdsApp.LanguageIterator Iterator of the requested languages.

withIds(ids)

Restricts this selector to return only languages with the given language IDs.

All languages are uniquely identified by the combination of their ad group ID and language ID. The IDs for this selector are thus represented as two-element arrays, with the first element being the ad group ID and the second being the language ID:

 var languageIds = [
   [12345, 987987],
   [23456, 876876],
   [34567, 765765],
 ];
 selector = selector.withIds(languageIds);

The resulting selector can be further refined by applying additional conditions to it. The ID-based condition will then be AND-ed together with all the other conditions, including any other ID-based conditions. So, for instance, the following selector:

 var ids1 = [
   [12345, 987987],
   [23456, 876876],
   [34567, 765765],
 ];
 var ids2 = [
   [34567, 765765],
   [45678, 654654],
   [56789, 543543],
 ];
 AdsApp.targeting().languages()
    .withIds(ids1)
    .withIds(ids2);
will only get the language with ID [34567, 765765], since it would be the only language that satisfies both ID conditions.

Arguments:

NameTypeDescription
ids long[][] Array of language IDs.

Return values:

TypeDescription
AdsApp.LanguageSelector The selector restricted to the given IDs.

withLimit(limit)

Specifies limit for the selector to use. For instance, withLimit(50) returns only the first 50 entities.

Arguments:

NameTypeDescription
limit int How many entities to return.

Return values:

TypeDescription
AdsApp.LanguageSelector The selector with limit applied.

Send feedback about...

Google Ads scripts
Google Ads scripts
Need help? Visit our support page.