NAME
Mojar::Google::Analytics::Request - Request object for GA reporting data.
SYNOPSIS
$req
= Mojar::Google::Analytics::Request->new
->dimensions([
qw( pagePath )
])
->metrics([
qw( visitors pageviews )
])
->
sort
(
'pagePath'
)
->max_results(
$max_resultset
);
DESCRIPTION
Provides a container object with convenience methods.
ATTRIBUTES
- access_token
-
Access token, obtained via JWT.
- ids
-
Profile ID (from your GA account) you want to use.
- dimensions
-
Arrayref to list of desired dimensions.
$req
->dimensions([
qw(pagePath)
]);
- metrics
-
Arrayref to list of desired metrics.
$req
->metrics([
qw(visitors newVisits visits bounces timeOnSite entrances
pageviews uniquePageviews timeOnPage exits)
]);
- segment
-
String containing desired segment.
- filters
-
Arrayref to list of desired filters.
$req
->filters([
'browser==Firefox'
]);
- sort
-
Specification of column sorting; either a single name (string) or a list (arrayref).
- start_date
-
Defaults to today.
- end_date
-
Defaults to today.
- start_index
-
Defaults to 1.
- max_results
-
Defaults to 10,000.
METHODS
- new
-
Constructor.
$req
= Mojar::Google::Analytics::Request->new(
dimensions
=> [
qw( pagePath )
],
metrics
=> [
qw( visitors pageviews )
],
sort
=>
'pagePath'
,
start_index
=>
$start
,
max_results
=>
$max_resultset
);
- params
-
String of request parameters.
$url
.=
q{?}
.
$req
->params;
CONFIGURATION AND ENVIRONMENT
You need to create a low-privilege user within your GA account, granting them access to an appropriate profile. Then register your application for unattended access. That results in a username and private key that your application uses for access.
SUPPORT
See Mojar.
SEE ALSO
Net::Google::Analytics is similar, main differences being dependencies and means of getting tokens.