Returns the average cost per thousand impressions.
Return values:
Type
Description
double
The average cost per thousand impressions.
getAverageCpv()
Returns the average cost per view.
Return values:
Type
Description
double
The average cost per view.
getAveragePageviews()
Returns the average number of pages viewed per visit. Only available for
Campaigns, Ad groups, Keywords, and Ads. Returns null for
other entity types. Returns null if the account is not linked
to Analytics.
Return values:
Type
Description
double
The average page views.
getAveragePosition()
Returns the average position. Returns null if this is a
Display entity that doesn't have an average position.
Return values:
Type
Description
double
The average position.
getAverageTimeOnSite()
Returns the average time a visitor spent on site, in seconds. Only
available for Campaigns, Ad groups, Keywords, and Ads. Returns
null for other entity types. Returns null if the
account is not linked to Analytics.
Return values:
Type
Description
double
The average time on site.
getBounceRate()
Returns the bounce rate of the entity, in 0..1 range. When a
visitor to your site sees only one page or triggers only one event,
Analytics considers this visit a "bounce." Only available for Campaigns, Ad
groups, Keywords, and Ads. Returns null for other entity
types. Returns null if the account is not linked to Analytics.
Return values:
Type
Description
double
The bounce rate.
getClicks()
Returns the number of clicks.
Return values:
Type
Description
long
The number of clicks.
getConversionRate()
Returns the rate of conversions.
Return values:
Type
Description
double
The rate of conversions.
getConversions()
Returns the number of conversions.
Return values:
Type
Description
double
The number of conversions.
getCost()
Returns the cost in the default currency of the account.
Return values:
Type
Description
double
The cost in the default currency of the account.
getCtr()
Returns the click through rate of the entity, in 0..1 range.
Return values:
Type
Description
double
The click through rate.
getImpressions()
Returns the number of impressions.
Return values:
Type
Description
long
The number of impressions.
getViewRate()
Returns the view rate of the entity, in 0..1 range.
[null,null,["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eStats\u003c/code\u003e object provides access to various performance metrics for different entity types in Google Ads scripts.\u003c/p\u003e\n"],["\u003cp\u003eCommon metrics like impressions, clicks, cost, and conversions are available for all entity types.\u003c/p\u003e\n"],["\u003cp\u003eAnalytics-related metrics like average pageviews, bounce rate, and average time on site are limited to Campaigns, Ad groups, Keywords, and Ads, requiring an Analytics link.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code snippet demonstrates how to retrieve and use these statistics within a script.\u003c/p\u003e\n"],["\u003cp\u003eAll metrics are returned with specific data types like \u003ccode\u003edouble\u003c/code\u003e for rates and averages, and \u003ccode\u003elong\u003c/code\u003e for counts.\u003c/p\u003e\n"]]],[],null,["# AdsApp.Stats\n\nStatistics common to various entity types.\n\nTypical usage:\n\n```gdscript\nvar stats = campaign.getStatsFor(\"LAST_MONTH\");\nvar impressions = stats.getImpressions();\nvar metrics.clicks = stats.getClicks();\n// etc.\n```\n\nNote that Analytics-related stats ([Stats.getAveragePageviews()](/google-ads/scripts/docs/reference/adsapp/adsapp_stats#getAveragePageviews),\n[Stats.getAverageTimeOnSite()](/google-ads/scripts/docs/reference/adsapp/adsapp_stats#getAverageTimeOnSite)\nand [Stats.getBounceRate()](/google-ads/scripts/docs/reference/adsapp/adsapp_stats#getBounceRate))\nare only available for Campaigns, Ad groups, Keywords, and Ads. The method\ncalls will return `null` for other entity types.\n\n### Methods:\n\n| Member | Type | Description |\n|-------------------------------------------------|----------|----------------------------------------------------------------|\n| [getAverageCpc()](#getAverageCpc) | `double` | Returns the average cost per click. |\n| [getAverageCpm()](#getAverageCpm) | `double` | Returns the average cost per thousand impressions. |\n| [getAverageCpv()](#getAverageCpv) | `double` | Returns the average cost per view. |\n| [getAveragePageviews()](#getAveragePageviews) | `double` | Returns the average number of pages viewed per visit. |\n| [getAveragePosition()](#getAveragePosition) | `double` | Returns the average position. |\n| [getAverageTimeOnSite()](#getAverageTimeOnSite) | `double` | Returns the average time a visitor spent on site, in seconds. |\n| [getBounceRate()](#getBounceRate) | `double` | Returns the bounce rate of the entity, in `0..1` range. |\n| [getClicks()](#getClicks) | `long` | Returns the number of clicks. |\n| [getConversionRate()](#getConversionRate) | `double` | Returns the rate of conversions. |\n| [getConversions()](#getConversions) | `double` | Returns the number of conversions. |\n| [getCost()](#getCost) | `double` | Returns the cost in the default currency of the account. |\n| [getCtr()](#getCtr) | `double` | Returns the click through rate of the entity, in `0..1` range. |\n| [getImpressions()](#getImpressions) | `long` | Returns the number of impressions. |\n| [getViewRate()](#getViewRate) | `double` | Returns the view rate of the entity, in `0..1` range. |\n| [getViews()](#getViews) | `long` | Returns the number of video views. |\n\n`getAverageCpc()`\n-----------------\n\nReturns the average cost per click.\n\n### Return values:\n\n| Type | Description |\n|----------|-----------------------------|\n| `double` | The average cost per click. |\n\n`getAverageCpm()`\n-----------------\n\nReturns the average cost per thousand impressions.\n\n### Return values:\n\n| Type | Description |\n|----------|--------------------------------------------|\n| `double` | The average cost per thousand impressions. |\n\n`getAverageCpv()`\n-----------------\n\nReturns the average cost per view.\n\n### Return values:\n\n| Type | Description |\n|----------|----------------------------|\n| `double` | The average cost per view. |\n\n`getAveragePageviews()`\n-----------------------\n\nReturns the average number of pages viewed per visit. Only available for Campaigns, Ad groups, Keywords, and Ads. Returns `null` for other entity types. Returns `null` if the account is not linked to Analytics.\n\n### Return values:\n\n| Type | Description |\n|----------|-------------------------|\n| `double` | The average page views. |\n\ngetAveragePosition()\n--------------------\n\nReturns the average position. Returns `null` if this is a Display entity that doesn't have an average position. **Deprecated.**Starting the week of September 30, 2019 this method will return null.\n\n### Return values:\n\n| Type | Description |\n|----------|-----------------------|\n| `double` | The average position. |\n\n`getAverageTimeOnSite()`\n------------------------\n\nReturns the average time a visitor spent on site, in seconds. Only available for Campaigns, Ad groups, Keywords, and Ads. Returns `null` for other entity types. Returns `null` if the account is not linked to Analytics.\n\n### Return values:\n\n| Type | Description |\n|----------|---------------------------|\n| `double` | The average time on site. |\n\n`getBounceRate()`\n-----------------\n\nReturns the bounce rate of the entity, in `0..1` range. When a visitor to your site sees only one page or triggers only one event, Analytics considers this visit a \"bounce.\" Only available for Campaigns, Ad groups, Keywords, and Ads. Returns `null` for other entity types. Returns `null` if the account is not linked to Analytics.\n\n### Return values:\n\n| Type | Description |\n|----------|------------------|\n| `double` | The bounce rate. |\n\n`getClicks()`\n-------------\n\nReturns the number of clicks.\n\n### Return values:\n\n| Type | Description |\n|--------|-----------------------|\n| `long` | The number of clicks. |\n\n`getConversionRate()`\n---------------------\n\nReturns the rate of conversions.\n\n### Return values:\n\n| Type | Description |\n|----------|--------------------------|\n| `double` | The rate of conversions. |\n\n`getConversions()`\n------------------\n\nReturns the number of conversions.\n\n### Return values:\n\n| Type | Description |\n|----------|----------------------------|\n| `double` | The number of conversions. |\n\n`getCost()`\n-----------\n\nReturns the cost in the default currency of the account.\n\n### Return values:\n\n| Type | Description |\n|----------|--------------------------------------------------|\n| `double` | The cost in the default currency of the account. |\n\n`getCtr()`\n----------\n\nReturns the click through rate of the entity, in `0..1` range.\n\n### Return values:\n\n| Type | Description |\n|----------|-------------------------|\n| `double` | The click through rate. |\n\n`getImpressions()`\n------------------\n\nReturns the number of impressions.\n\n### Return values:\n\n| Type | Description |\n|--------|----------------------------|\n| `long` | The number of impressions. |\n\n`getViewRate()`\n---------------\n\nReturns the view rate of the entity, in `0..1` range.\n\n### Return values:\n\n| Type | Description |\n|----------|----------------|\n| `double` | The view rate. |\n\n`getViews()`\n------------\n\nReturns the number of video views.\n\n### Return values:\n\n| Type | Description |\n|--------|----------------------------|\n| `long` | The number of video views. |"]]