Mojo::GoogleAnalytics::Report - Represents a Google Analytics report
See Mojo::GoogleAnalytics.
Mojo::GoogleAnalytics::Report represents a result from "batch_get" in Mojo::GoogleAnalytics.
$int = $self->count;
Returns the total count of rows that can be returned by Google Analytics.
$hash_ref = $self->error;
Holds a hash ref if an error occurred and undef if not. Example data structure:
{ code => 403, message => "Something went wrong", }
$hash_ref = $self->maximums;
Holds a hash ref with the maximum metrics. Example:
{ "ga:pageviews" => 349, "ga:sessions" => 40, }
$hash_ref = $self->minimums;
See "maximums".
$str = $self->page_token;
Holds a token that can be used to query Google Analytics for more data.
$hash_ref = $self->query;
Holds the query passed on to "batch_get" in Mojo::GoogleAnalytics.
$array_ref = $self->rows;
Holds the row data returned from Google Analytics. Example:
[ { dimensions => ["Norway", "Chrome"], metrics => [{values => [349, 40]}], }, ... ]
$hash_ref = $self->totals;
$tx = $self->tx;
Holds the raw Mojo::Transaction object used in the request. Useful if you need to extract raw data:
my $raw_data = $tx->res->json;
$hash_ref = $self->rows_to_hash;
Creates a multi dimensional hash, from the "dimensions" in the rows. Example result:
# Query dimensions: [{name => 'ga:country'}, {name => 'ga:browser'}] # Result: { Norway => { Chrome => { "ga:pageviews" => 349, "ga:sessions" => 40, }, ... }, ... }
$array_ref = $self->rows_to_table(no_headers => 1); $str = $self->rows_to_table(as => "text", no_headers => 1);
Converts "rows" into tabular data. as can be used to return the table as either "text" or "hash" (default). Set no_headers to a true value to avoid getting the first item in the $array_ref as header names. Example "text" output:
as
no_headers
$array_ref
ga:country ga:browser ga:pageviews ga:sessions Sweden Chrome 472493 43340 Sweden Safari 413833 43242 Denmark Safari 127321 13975 Denmark Chrome 124904 12077 Norway Chrome 105998 10066
Jan Henning Thorsen
Mojo::GoogleAnalytics.
To install Mojo::GoogleAnalytics, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::GoogleAnalytics
CPAN shell
perl -MCPAN -e shell install Mojo::GoogleAnalytics
For more information on module installation, please visit the detailed CPAN module installation guide.