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 if there are fewer than 5 keywords that have the labels "abc" or "xyz" contained in the campaign or ad group. In this example, "keywords" is the 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 2 approved sitelinks or call assets associated with the campaign or ad group.

COUNT(ads) > 3

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

COUNT(labels) = 2

Checks if there are exactly 2 labels applied to the item being filtered. This can even be applied to non-containers, such as keywords, to see all keyword that contain exactly 2 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 they don't apply to. For example: COUNT(keywords; sitelinks, keywordwordcount = 2 linktext : "local") will count the number of contained keywords having exactly 2 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 will not 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
550115985277474599
true
Search Help Center
true
true
true
true
true
73067
false
false