Google Analytics Api Program

Write a PHP program that accesses the Google Analytics API using GAPI (Google Analytics PHP Interface) to return information about how visitors reach a website and then whether they bounce or convert.

Requirements
Provide Sample of a Past Google API Project in PHP
Produce well-documented PHP code
Use GAPI to interact with the Google Analytics API
http://code.google.com/p/gapi-google-analytics-php-interface/
Provide the methods below

Required Methods
get_top_keywords( $number_of_keywords, $start_date, $end_date )
Param int $number_of_keywords – The number of keywords to return the bounce and conversion rates for
Param string $start_date – The start date for the range to query (YYYY-MM-DD)
Param string $end_date – The end date for the range to query (YYYY-MM-DD)
Return array
Array(
Array(
‘keyword’ => ‘keyword one’,
‘bounce_rate’ => ‘%%’,
‘conversion_rate’ => ‘%%’
‘percent_of_site_traffic’ => ‘%%’
),
Array(
‘keyword’ => ‘keyword two’,
‘bounce_rate’ => ‘%%’,
‘conversion_rate’ => ‘%%’
‘percent_of_site_traffic’ => ‘%%’
)
)

get_top_geo( $number_of_geo, $start_date, $end_date )
Param int $number_of_geo – The number of locations to return the bounce and conversion rates for
Param string $start_date – The start date for the range to query (YYYY-MM-DD)
Param string $end_date – The end date for the range to query (YYYY-MM-DD)
Return array
Array(
Array(
‘location’ => ‘City, State’,
‘bounce_rate’ => ‘%%’,
‘conversion_rate’ => ‘%%’
‘percent_of_site_traffic’ => ‘%%’
),
Array(
‘location’ => ‘City, State’,
‘bounce_rate’ => ‘%%’,
‘conversion_rate’ => ‘%%’
‘percent_of_site_traffic’ => ‘%%’
)
)

get_top_referrals( $number_of_referrals, $start_date, $end_date )
Param int $number_of_referrals – The number of referrals to return the bounce and conversion rates for
Param string $start_date – The start date for the range to query (YYYY-MM-DD)
Param string $end_date – The end date for the range to query (YYYY-MM-DD)
Return array
Array(
Array(
‘referral’ => ‘http://’,
‘bounce_rate’ => ‘%%’,
‘conversion_rate’ => ‘%%’
‘percent_of_site_traffic’ => ‘%%’
),
Array(
‘referral’ => ‘http://’,
‘bounce_rate’ => ‘%%’,
‘conversion_rate’ => ‘%%’
‘percent_of_site_traffic’ => ‘%%’
)
)

Leave a Reply

Your email address will not be published. Required fields are marked *