WWW::Tracking::Data::Plugin::GoogleAnalytics - serialize to Google Analytics URL
use WWW::Tracking; use WWW::Tracking::Data::Plugin::GoogleAnalytics; my $wt = WWW::Tracking->new( 'tracker_account' => 'MO-9226801-5', 'tracker_type' => 'ga', ); $wt->from( 'headers' => { 'headers' => $headers, 'request_uri' => $request_uri, 'remote_ip' => $remote_ip, 'visitor_cookie_name' => $VISITOR_COOKIE_NAME, }, ); my $visitor_id = $wt->data->visitor_id; my $tracking_cookie = Apache2::Cookie->new( $apache, '-name' => $VISITOR_COOKIE_NAME, '-value' => $visitor_id, '-expires' => '+3M', '-path' => '/', ); $tracking_cookie->bake($apache); eval { $wt->make_tracking_request; }; if ($@) { $logger->warn('failed to do request tracking - '.$@); }
To install WWW::Tracking, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Tracking
CPAN shell
perl -MCPAN -e shell install WWW::Tracking
For more information on module installation, please visit the detailed CPAN module installation guide.