AdsApp.​Stats

Statistics common to various entity types.

Typical usage:

var stats = campaign.getStatsFor("LAST_MONTH");
var impressions = stats.getImpressions();
var metrics.clicks = stats.getClicks();
// etc.

Note that Analytics-related stats (Stats.getAveragePageviews(), Stats.getAverageTimeOnSite() and Stats.getBounceRate()) are only available for Campaigns, Ad groups, Keywords, and Ads. The method calls will return null for other entity types.

Methods:

MemberTypeDescription
getAverageCpc double Returns the average cost per click.
getAverageCpm double Returns the average cost per thousand impressions.
getAverageCpv double Returns the average cost per view.
getAveragePageviews double Returns the average number of pages viewed per visit.
getAveragePosition double Returns the average position.
getAverageTimeOnSite double Returns the average time a visitor spent on site, in seconds.
getBounceRate double Returns the bounce rate of the entity, in 0..1 range.
getClicks long Returns the number of clicks.
getConversionRate double Returns the rate of conversions.
getConversions double Returns the number of conversions.
getCost double Returns the cost in the default currency of the account.
getCtr double Returns the click through rate of the entity, in 0..1 range.
getImpressions long Returns the number of impressions.
getViewRate double Returns the view rate of the entity, in 0..1 range.
getViews long Returns the number of video views.

getAverageCpc()

Returns the average cost per click.

Return values:

TypeDescription
double The average cost per click.

getAverageCpm()

Returns the average cost per thousand impressions.

Return values:

TypeDescription
double The average cost per thousand impressions.

getAverageCpv()

Returns the average cost per view.

Return values:

TypeDescription
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:

TypeDescription
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:

TypeDescription
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:

TypeDescription
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:

TypeDescription
double The bounce rate.

getClicks()

Returns the number of clicks.

Return values:

TypeDescription
long The number of clicks.

getConversionRate()

Returns the rate of conversions.

Return values:

TypeDescription
double The rate of conversions.

getConversions()

Returns the number of conversions.

Return values:

TypeDescription
double The number of conversions.

getCost()

Returns the cost in the default currency of the account.

Return values:

TypeDescription
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:

TypeDescription
double The click through rate.

getImpressions()

Returns the number of impressions.

Return values:

TypeDescription
long The number of impressions.

getViewRate()

Returns the view rate of the entity, in 0..1 range.

Return values:

TypeDescription
double The view rate.

getViews()

Returns the number of video views.

Return values:

TypeDescription
long The number of video views.