GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::GOOGLE::ANALYTICS::RESPONSE (3)

.ds Aq ’

NAME

Net::Google::Analytics::Response - Google Analytics API response

CONTENTS

VERSION

version 3.03

SYNOPSIS



    my $res = $analytics->retrieve($req);
    die("GA error: " . $res->error_message) if !$res->is_success;

    print
        "Results: 1 - ", $res->num_rows,
        " of ", $res->total_results, "\n\n";

    for my $row (@{ $res->rows }) {
        print
            $row->get_source,  ": ",
            $row->get_visits,  " visits, ",
            $row->get_bounces, " bounces\n";
    }

    print
        "\nTotal: ",
        $res->totals("visits"),  " visits, ",
        $res->totals("bounces"), " bounces\n";



DESCRIPTION

Response class for Net::Google::Analytics web service.

CONSTRUCTOR

    new

ACCESSORS

    is_success

True for successful requests, false in case of an error.

    code

The HTTP status code.

    message

The HTTP status message.

    content

In case of an error, this field contains a JSON string with additional information about the error from the response body.

    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 result rows.

    items_per_page

The number of rows returned.

    contains_sampled_data

Returns true if the results contain sampled data.

    profile_info

A hashref containing information about the analytics profile.

    num_rows

The number of rows on this result page.

    rows

An arrayref of result rows of type Net::Google::Analytics::Row.

    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 sum of all results for a metric regardless of the actual subset of results returned. $metric is a metric name without the ’ga:’ prefix and converted to lower case with underscores.

    project



    my $projected = $res->project(\@proj_dim_names, \&projection);



Projects the dimension values of every result row to new dimension values using subroutine reference \&projection. The metrics of rows 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.

Returns a new response object.

The following example maps a single dimension of type ga:pagePath to categories.



    my $projected = $res->project([ category ], sub {
        my $row = shift;

        my $page_path = $row->get_page_path;

        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) 2015 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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::GOOGLE::ANALYTICS::RESPONSE (3) 2015-03-18

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.