Google Analytics PHP API class
This class provides methods for retrieving data from the Google Analytics API.
It provides a number of basic methods to directly get a PHP array with visitors, pageviews, referrers, etc.
You can also use the method getData() to use any number of metrics and dimensions to get an array with the results.
It provides basic caching stored in a session for fast responses.
A basic example is provided in the demo below and in the download.
Ex code:
<?php
session_start();
require ‘analytics.class.php’;
try {
$oAnalytics = new analytics(’[username]‘, ‘[password]‘);
$oAnalytics->useCache();
$oAnalytics->setProfileByName(’[Google analytics accountname]‘);
$oAnalytics->setMonth(date(’n'), date(’Y'));
echo ‘<pre>’;
print_r($oAnalytics->getVisitors());
print_r($oAnalytics->getPageviews());
print_r($oAnalytics->getData(array( ‘dimensions’ => ‘ga:keyword’,
‘metrics’ => ‘ga:visits’,
’sort’ => ‘ga:keyword’)));
} catch (Exception $e) {
echo ‘Caught exception: ‘ . $e->getMessage();
}
?>
Random Post
Related Articles
- How to Use Western Union quick cash at Google Adsense ?
- Western Union available in VietNam
- Free Adword voucher $50
- How to create Shortlinks with Google Apps
- The Google Analytics API and PHP
- Using the Google Analytics API - getting total number of page views
- Adsense launching “Category filter Beta”
- What is Adsense Smart Price ?
- How to avoid Adsense Smart Pricing ?
Recent Posts
- Free Panda Internet Security 2010: Windows 7 Launch Party
- FREE 1-year license of Kaspersky Internet Security 2010!
- Warning hack password Yahoo mail !
- How to Use Western Union quick cash at Google Adsense ?
- Western Union available in VietNam
- Facebook for Nokia phones
- DailyMotion now offering Embed HD Video Players
- Free Adword voucher $50
- How to create Shortlinks with Google Apps
- Auto post to Blogger with PHP
- Free Auto Blogger: Auto post rss feed
- The Google Analytics API and PHP
- Using the Google Analytics API - getting total number of page views
- Google Analytics PHP API class
- Blogger team warning Spam posts
- Adsense launching “Category filter Beta”
- Alternatives to Google Adsense by other programs
- What is Adsense Smart Price ?
- How to avoid Adsense Smart Pricing ?
- How to use Adsense again if get banned
Recent Comments
- Patrik
in Warning hack password Yahoo mail ! - Nancy
in Auto post to Blogger with PHP - Tony M J
in DailyMotion now offering Embed HD V… - fonfenVak
in Enable Ping track in wordpress - DaiVyCorp - Int…
in My Google AdSense Account Is Disabl… - DaiVyCorp - Int…
in My Google AdSense Account Is Disabl… - AlexAxe
in VPN Protocols - jennefoh
in Make more money: YouTube Videos Com… - GlenStef
in VPN Protocols - DaiVyCorp - Int…
in Why should I use proxy servers ?
Most Commented
- Top 10 ways to boost alexa ranking (4)
- How to Boost Alexa Ranking (4)
- VPN Protocols (4)
- Make more money: YouTube Videos Coming to AdSense (2)
- My Google AdSense Account Is Disabled (2)
- Top 10 secrets success with business online (1)
- SEO with Site Address / URL (1)
- Free Ways to Increase Your Blog Traffic (1)
- How to SEO wordpress, The Complete Guide (1)
- Manual Unzip Server Command (1)
Most Viewed Post
- Top 10 ways to boost alexa ranking - 1,802 views
- Invalid Clicks Contact Form: How to contact to Google Adsense support Team - 1,274 views
- Auto post to Blogger with PHP - 1,250 views
- Adsense launching “Category filter Beta” - 1,204 views
- Tutorial: IPSec Security structure - 1,197 views
- How to SEO Copywrite - 1,148 views
- Free Auto Blogger: Auto post rss feed - 1,061 views
- SEO with Site Address / URL - 1,040 views
- How to Use Western Union quick cash at Google Adsense ? - 962 views
- How to Prevent Spam VBB with GeoIPCountry - 922 views
Categories
- How to (51)
- SEO (33)
- Google adsense (31)
- Business land (13)
- Security Policies (21)
- Tips (26)
- Technology news (7)
- Traffic guide (9)
- Top secrets MMO (6)
- Tutorials (10)











No Comment
Leave Your Comments Below