The ALL(...)
function checks if an item only contains items matching a filter. When checking, you specify the types for which contained items should be matched, and a child filter to indicate what the contained items need to match.
ALL is a convenience function that makes checks on all contained items simpler to write. ALL(types, filter)
is equivalent to COUNT(types, NOT(filter)) = 0
. In other words, ALL helps to find containers that don't contain items not matching the child filter.
Syntax
ALL(types, [filter])
types
-- the type of contained items to check.filter
-- all contained items must match this filter.
Examples
ALL(keywords, labels = ("abc", "xyz") )
Checks if all keywords in the campaign or ad group have the labels "abc" or "xyz". In this example, "keywords" is the type of item to check, while "labels = ("abc", "xyz")" is the child filter they must all match.
ALL(callextensions; sitelinks, approvalstatus = approved)
Checks if all sitelinks and call assets associated with the campaign or ad group are approved.
Notes
- If there are multiple conditions in the child filter, they must all match the contained items. They can be wrapped in an OR function to check that contained items match any of the conditions. For example,
ALL(ads, OR(status = paused approvalstatus = disapproved))
will check if all ads are either paused, disapproved, or both. - The filter can contain conditions that only apply to some types and those conditions will be ignored for the types they don't apply to. For example:
ALL(keywords; sitelinks, keywordwordcount = 2 linktext : "local")
will check that all keywords have exactly 2 words and that all associated sitelinks contains "local" in their link text. - If there are no contained items of the specified type, the ALL check will succeed. For example,
ALL(keywords, status = enabled)
will show a campaign or ad group if it contains no keywords at all. This is because the example is simply a convenience function forCOUNT(keywords, NOT(status = enabled)) = 0
, and the number of keywords that aren't enabled in the campaign or ad group is exactly 0. To restrict the results to only those items that contain at least one item matching the filter, you can add an EXIST function with the same types and child filter as ALL. So in this example, you could use this filter:EXIST(keywords, status = enabled) ALL(keywords, status = enabled)
. In other words, this filter would show the campaigns where there exists at least one enabled keyword and all keywords are enabled.
Using the ALL function with campaigns and ad groups
For items that can only be contained within ad groups, checking at the campaign level will check all items from all ad groups to see if they match the child filter. For example, ALL(keywords, status = enabled)
at the campaign level shows if all keywords in all ad groups of the campaign are enabled.
For items that can be contained within ad groups or campaigns, checking at the campaign level will only check items directly within the campaign. For example, ALL(audiences, status = enabled)
at the campaign level will show the campaign if all its campaign-level audiences are enabled, even if the campaign has some ad group-level audiences that aren't enabled. The same is true for assets: ALL(sitelinks, status = enabled)
at the campaign level will only check campaign-level sitelinks, not ad group-level sitelinks within the campaign.