NAME

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

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.

ACCESSORS

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

Copyright (C) Nick Wellnhofer, 2010

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.