NAME
Net::Google::Analytics::Response - Google Analytics API response
VERSION
version 2.99_01
DESCRIPTION
Response class for Net::Google::Analytics web service.
ACCESSORS
is_success
True for successful requests, false in case of an error
code
The HTTP status code
message
The HTTP status message
error_message
The full error message
total_results
The total number of results for the query, regardless of the number of results in the response.
start_index
The 1-based start index of the entries.
items_per_page
The number of rows.
rows
An arrayref of result rows.
dimensions
An array of all dimension names without the 'ga:' prefix and converted to lower case with underscores.
metrics
An array of all metric names without the 'ga:' prefix and converted to lower case with underscores.
METHODS
totals
my $total = $res->totals($metric);
Returns the total of all results for a metric. $metric is a metric name without the 'ga:' prefix and converted to lower case with underscores.
project
$res->project(\@proj_dim_names, \&projection);
Projects the dimension values of every entry to a set of new dimension values using subroutine reference \&projection. The metrics of entries that are mapped to the same dimension values are summed up.
Argument \@proj_dim_names is an arrayref containing the names of the new dimensions.
The projection subroutine takes as single argument a Net::Google::Analytics::Row object and must return an array of dimension values.
The following example maps a single dimension of type ga:pagePath to categories.
$res->project([ 'category' ], sub {
my $row = shift;
my $page_path = $row->get_pagePath;
return ('flowers') if $page_path =~ m{^/(tulips|roses)};
return ('fruit') if $page_path =~ m{^/(apples|oranges)};
return ('other');
});
AUTHOR
Nick Wellnhofer <wellnhofer@aevum.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Nick Wellnhofer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.