Stats

Contains the methods for accessing an entity's performance data.

To get performance data for an entity such as a campaign or keyword, call the entity's getStats method. But you can only call getStats if the selector that you used to get the entity includes one of the forDateRange methods in its chain.

The following campaign selector uses the version of forDateRange that uses predefined date ranges like LAST_WEEK or LAST_MONTH. The other version lets you specify the data range using specific dates.

Example usage:

    var campaign = AdsApp.campaigns()
        .forDateRange("LAST_WEEK")
        .get()
        .next();
    var stats = campaign.getStats();
    var conversionRate = stats.getConversionRate();
    var convertedClicks = stats.getConversions();
    // etc.

Methods

Method Name Return Type Description
getAbsoluteTopImpressionRate double Gets the absolute top impression rate percent.
getAverageCpc double Gets the average cost per click.
getAverageCpm double Gets the average cost per thousand impressions.
getAveragePosition double This method is no longer available as of March 31, 2021.
getClickConversionRate double (Use the getConversionRate() method instead.)
getClicks long Gets the number of clicks.
getConversionRate double Gets the conversion rate for clicks.
getConversions long Gets the number of clicks that converted.
getConvertedClicks long (Use the getConversions() method instead.)
getCost double Gets the cost (spend) in the account's currency.
getCtr double Gets the click through rate.
getImpressions long Gets the number of impressions.
getReturnOnAdSpend long Gets the return on ad spend.
getRevenue long Gets the advertiser-reported revenue.
getTopImpressionRate double Gets the top impression rate percent.

getAbsoluteTopImpressionRate

Gets how often your ad was in the first position of all results, as a percentage of your total impressions.

Returns

Type Description
double How often your ad was in the first position of all results, as a percentage of your total impressions.

getAverageCpc

Gets the average cost per click.

Returns

Type Description
double The average cost per click.

getAverageCpm

Gets the average cost per thousand impressions.

Returns

Type Description
double The average cost per one-thousand impressions.

getAveragePosition

Gets the average position where ads were placed.

Note

This method is no longer available as of March 31, 2021.

Returns

Type Description
double The average position where ads were placed.

getClickConversionRate

Gets the conversion rate for clicks.

Note

Because this method may be deprecated in a future release, use the getConversionRate method instead.

Returns

Type Description
double The conversion rate for clicks, in the range 0..1.

getClicks

Gets the number of clicks.

Returns

Type Description
long The number of clicks.

getConversionRate

Gets the conversion rate for clicks.

Returns

Type Description
double The conversion rate for clicks, in the range 0..1.

getConversions

Gets the number of clicks that were converted.

Returns

Type Description
long The number of clicks that were converted.

getConvertedClicks

Gets the number of clicks that converted.

Note

Because this method may be deprecated in a future release, use the getConversions method instead.

Returns

Type Description
long The number of clicks that converted.

getCost

Gets the cost (spend) in the account's currency.

Returns

Type Description
double The cost in the account's currency.

getCtr

Gets the click-through rate.

Returns

Type Description
double The click-through rate, in the range 0..1.

getImpressions

Gets the number of impressions.

Returns

Type Description
long The number of impressions.

getReturnOnAdSpend

Gets the return on ad spend.

Returns

Type Description
double The return on ad spend, which is calculated as (revenue / spend) * 100.

getRevenue

Gets the advertiser-reported revenue.

Returns

Type Description
double The revenue reported by the advertiser.

getTopImpressionRate

Gets the percentage of times your ad showed in the mainline, the top placement where ads appear above the search results, out of your total impressions.

Returns

Type Description
double The percentage of times your ad showed in the mainline, the top placement where ads appear above the search results, out of your total impressions.