AdsApp.LanguageSelector
Stay organized with collections
Save and categorize content based on your preferences.
Fetches languages. Supports filtering and sorting. Typical usage:
var
languageSelector
=
campaign
.
targeting
()
.
languages
()
.
withCondition
(
"metrics.impressions > 100"
)
.
orderBy
(
"metrics.clicks DESC"
);
var
languageIterator
=
languageSelector
.
get
();
while
(
languageIterator
.
hasNext
())
{
var
language
=
languageIterator
.
next
();
}
Related:
Methods:
get()
Fetches the requested languages and returns an iterator. Return values:
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:
Return values:
withLimit(limit)
Specifies limit for the selector to use. For instance, withLimit(50)
returns only the first 50 entities. Arguments:
Return values:
withResourceNames(resourceNames)
Restricts this selector to return only languages with the
given Google Ads API resource names. const
languageResourceNames
=
[
'customers/1234567890/campaignCriteria/111~222'
,
'customers/1234567890/campaignCriteria/111~333'
,
'customers/1234567890/campaignCriteria/444~555'
,
];
selector
=
selector
.
withResourceNames
(
languageResourceNames
);
The resulting selector can be further refined by applying additional
conditions to it. The resource name condition will then be AND-ed together
with all the other conditions.
The selector can only support up to 10,000 resource names. If more than
10,000 resource names are specified, the corresponding get() call will fail
with a runtime error.
Arguments:
Return values:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eFetches languages for targeting in Google Ads campaigns and allows for filtering and sorting.\u003c/p\u003e\n"],["\u003cp\u003eProvides methods like \u003ccode\u003ewithIds\u003c/code\u003e, \u003ccode\u003ewithLimit\u003c/code\u003e, and \u003ccode\u003ewithResourceNames\u003c/code\u003e to refine the selection of languages.\u003c/p\u003e\n"],["\u003cp\u003eReturns an iterator (\u003ccode\u003eLanguageIterator\u003c/code\u003e) to access the selected languages.\u003c/p\u003e\n"],["\u003cp\u003eSupports conditions and ordering to further customize the results based on metrics like impressions or clicks.\u003c/p\u003e\n"],["\u003cp\u003eCan be used to identify languages based on their IDs or Google Ads API resource names.\u003c/p\u003e\n"]]],[],null,["# AdsApp.LanguageSelector\n\nFetches languages. Supports filtering and sorting.\n\nTypical usage:\n\n```gdscript\nvar languageSelector = campaign.targeting()\n .languages()\n .withCondition(\"metrics.impressions \u003e 100\")\n .orderBy(\"metrics.clicks DESC\");\n\nvar languageIterator = languageSelector.get();\nwhile (languageIterator.hasNext()) {\n var language = languageIterator.next();\n}\n```\nRelated:\n\n- [LanguageIterator](/google-ads/scripts/docs/reference/adsapp/adsapp_languageiterator)\n- [Language](/google-ads/scripts/docs/reference/adsapp/adsapp_language)\n\n### Methods:\n\n| Member | Type | Description |\n|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|\n| [get()](#get) | [AdsApp.LanguageIterator](/google-ads/scripts/docs/reference/adsapp/adsapp_languageiterator) | Fetches the requested languages and returns an iterator. |\n| [withIds(ids)](#withIds_ids) | [AdsApp.LanguageSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_languageselector) | Restricts this selector to return only languages with the given language IDs. |\n| [withLimit(limit)](#withLimit_limit) | [AdsApp.LanguageSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_languageselector) | Specifies limit for the selector to use. |\n| [withResourceNames(resourceNames)](#withResourceNames_resourceNames) | [AdsApp.LanguageSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_languageselector) | Restricts this selector to return only languages with the given Google Ads API resource names. |\n\n`get()`\n-------\n\nFetches the requested languages and returns an iterator.\n\n### Return values:\n\n| Type | Description |\n|----------------------------------------------------------------------------------------------|--------------------------------------|\n| [AdsApp.LanguageIterator](/google-ads/scripts/docs/reference/adsapp/adsapp_languageiterator) | Iterator of the requested languages. |\n\n`withIds(ids)`\n--------------\n\nRestricts this selector to return only languages with the given language IDs.\n\nAll languages are uniquely identified by the combination\nof their\nad group ID and language ID. The IDs for this selector are\nthus represented as two-element arrays, with the first element being the\nad group ID and the second being the language ID:\n\n```gdscript\nvar languageIds = [\n ['12345', '987987'],\n ['23456', '876876'],\n ['34567', '765765'],\n];\nselector = selector.withIds(languageIds);\n```\n\nThe resulting selector can be further refined by applying additional\nconditions to it. The ID-based condition will then be AND-ed together with\nall the other conditions, including any other ID-based conditions. So, for\ninstance, the following selector:\n\n```gdscript\nvar ids1 = [\n ['12345', '987987'],\n ['23456', '876876'],\n ['34567', '765765'],\n];\nvar ids2 = [\n ['34567', '765765'],\n ['45678', '654654'],\n ['56789', '543543'],\n];\nAdsApp.targeting().languages()\n .withIds(ids1)\n .withIds(ids2);\n```\nwill only get the language with ID `['34567',\n'765765']`, since it would be the only language that satisfies both ID conditions.\n\n### Arguments:\n\n| Name | Type | Description |\n|------|--------------|------------------------|\n| ids | `Object[][]` | Array of language IDs. |\n\n### Return values:\n\n| Type | Description |\n|----------------------------------------------------------------------------------------------|-------------------------------------------|\n| [AdsApp.LanguageSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_languageselector) | The selector restricted to the given IDs. |\n\n`withLimit(limit)`\n------------------\n\nSpecifies limit for the selector to use. For instance, `withLimit(50)` returns only the first 50 entities.\n\n### Arguments:\n\n| Name | Type | Description |\n|-------|-------|------------------------------|\n| limit | `int` | How many entities to return. |\n\n### Return values:\n\n| Type | Description |\n|----------------------------------------------------------------------------------------------|----------------------------------|\n| [AdsApp.LanguageSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_languageselector) | The selector with limit applied. |\n\n`withResourceNames(resourceNames)`\n----------------------------------\n\nRestricts this selector to return only languages with the given Google Ads API resource names. \n\n```gdscript\nconst languageResourceNames = [\n 'customers/1234567890/campaignCriteria/111~222',\n 'customers/1234567890/campaignCriteria/111~333',\n 'customers/1234567890/campaignCriteria/444~555',\n];\nselector = selector.withResourceNames(languageResourceNames);\n```\n\nThe resulting selector can be further refined by applying additional\nconditions to it. The resource name condition will then be AND-ed together\nwith all the other conditions.\n\nThe selector can only support up to 10,000 resource names. If more than\n10,000 resource names are specified, the corresponding get() call will fail\nwith a runtime error.\n\n### Arguments:\n\n| Name | Type | Description |\n|---------------|------------|-----------------------------------|\n| resourceNames | `String[]` | Array of language resource names. |\n\n### Return values:\n\n| Type | Description |\n|----------------------------------------------------------------------------------------------|------------------------------------------------------|\n| [AdsApp.LanguageSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_languageselector) | The selector restricted to the given resource names. |"]]