NAME

Net::Google::Analytics::DataFeedResponse - Google Analytics API data feed response

VERSION

version 0.11001

DESCRIPTION

This package is a subclass of Net::Google::Analytics::FeedResponse and implements parts of the data feed response of the Google Analytics Data Export API. The entries in the feed response are of type Net::Google::Analytics::DataFeedEntry.

See http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDataFeed.html#dataResponse for a complete reference.

ATTRIBUTES

aggregates

my $aggregates = $res->aggregates;

Returns an arrayref of Net::Google::Analytics::Metric objects.

METHODS

project

$res->project($projection);
$res->project(\&projection);
$res->project(sub { ... });

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.

The projection subroutine takes as single argument an arrayref of dimension objects and must return an array of dimension values.

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

$res->project(sub {
    my $dimensions = shift;
    
    my $page_path = $dimensions->[0]->value;

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