Using the COUNT function

The COUNT(...) function counts the number of contained items that match an optional filter. When counting, you specify the types for which contained items should be counted, and optionally a child filter condition to indicate which contained items should be counted. Contained items not matching the child filter or not of the specified types aren't counted. If the filter isn't specified, the function will count all items of the specified types.

Syntax

COUNT(types, [filter])
  • types – the types of contained items to count.
  • filter [optional] – contained items must match this filter to be counted.

You can count items relative to a certain number:

  • Greater than >
  • Greater than or equal to >=
  • Less than <
  • Less than or equal to <=
  • Equal =
  • Does not equal - =

Examples

COUNT(keywords, labels = ('abc', 'xyz') ) < 5

Checks whether there are fewer than five keywords that have the labels 'abc' or 'xyz' contained in the campaign or ad group. In this example, 'keywords' is the type of item being counted, while labels = ('abc', 'xyz') is the child filter.

COUNT(callextensions; sitelinks, approvalstatus = approved) >= 2

Checks if there are at least two approved sitelinks or call assets associated with the campaign or ad group.

COUNT(ads) > 3

Checks if there are more than three ads of any type in the campaign or ad group.

COUNT(labels) = 2

Checks if there are exactly two labels applied to the item being filtered. This can even be applied to non-containers, such as keywords, to see all keywords that contain exactly two labels.

Notes

  • If there are multiple conditions in the filter, they must all match for the item to be counted. They can be wrapped in an OR function to count items matching any of the conditions. For example, COUNT(ads, OR(status = paused approvalstatus = disapproved)) > 10 will check if there are more than 10 ads which 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 that they don't apply to. For example: COUNT(keywords; sitelinks, keywordwordcount = 2 linktext : 'local') will count the number of contained keywords having exactly two words plus the number of associated sitelinks that contain 'local' in their link text.

Using the COUNT function with campaigns and ad groups

For items that can only be contained within ad groups, counting at the campaign level will total all items from all ad groups. For example, COUNT(keywords) at the campaign level gets the total number of keywords in all ad groups of the campaign.

For items that can be contained within ad groups or campaigns, counting at the campaign level will only count the items directly within the campaign. For example, COUNT(audiences) at the campaign level will only count campaign-level audiences. It won't also total up ad group-level audiences within the campaign. The same is true for assets: COUNT(sitelinks) at the campaign level will only count campaign-level sitelinks, not ad group-level sitelinks within the campaign.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
16447639046949195554
true
Search Help Centre
true
true
true
true
true
73067
false
false