As many of you probably know, Patrick Hartman created a very nice starter example for PERL and Google Analytics. However, for those of you that have had trouble passing the segment parameter into the URI, there is a fix. After some digging, I realized that Google was returning GData version 1, and not version 2. Since segments are a relatively new addition to the GA Data Export API, using version one, the request treats the segment parameter as “junk”. Therefore, if you are using Patrick Hartman’s code, in the gaDataFeed subroutine, change:
my @headers … (old)
to
my @headers = (“Content-type” => “application/x-www-form-urlencoded”, Authorization => “GoogleLogin Auth=$token”, “GData-Version” => “2″);
-Jeffrey Shih (shihzy@gmail.com)
Filed under: analytics Tagged: | analytics, google, google data export api, perl





