Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embeddable Google Analytics "Flair"?

Now that Google Analytics has an official API, are there any implementations of a small, minimalistic "Flair" like snippet showing a customizable selection of stats, say for example, today's and the week's visitors, and maybe a chart or two - to embed into one's own admin panels and back-end applications?

I am ideally looking for implementations based on PHP; the perfect solution would be able to run stand-alone (no big dependencies) and require just to put in the API key / login data to get started. Clean code and PHP 5 OOP would be a plus.

like image 705
Pekka Avatar asked Mar 03 '10 18:03

Pekka


3 Answers

GAPI sound like what you need.

GAPI (said 'g,a,p,i') is the Google Analytics PHP5 Interface.

http://code.google.com/p/gapi-google-analytics-php-interface/

use it as follows:

$ga = new gapi('[email protected]','password');

$ga->requestReportData(145141242,array('browser','browserVersion'),array('pageviews','visits'));

foreach($ga->getResults() as $result)
{
  echo '<strong>'.$result.'</strong><br />';
  echo 'Pageviews: ' . $result->getPageviews() . ' ';
  echo 'Visits: ' . $result->getVisits() . '<br />';
}

echo '<p>Total pageviews: ' . $ga->getPageviews() . ' total visits: ' . $ga->getVisits() . '</p>';
like image 120
Phil Rykoff Avatar answered Nov 14 '22 20:11

Phil Rykoff


These are Joomla modules with php source:

  • jLabs Google Analytics Counter:"This simple Google Analytics Counter is based on the WebResourcesDepot tutorial with the same title. And it's converted to Joomla module just for our lovely community. This counter already equipped with various color of badge styles similar with a FeedBurner's subcription counter or a Twitter Follower counter as seen in the top blog sites."

  • GAnalytics: "GAnalytics is a complete suite which brings your google analytics data in form of charts or lists to your joomla powered web site"

The first one is based in this framework independent tutorial:

  • FeedCount-Like Google Analytics Counter: "We'll be creating a dynamic FeedCount-like interface that can display your website's statistics like pageviews, visits, etc. (one or all of them) using PHP"

Which displays something like this:
ga counter http://img690.imageshack.us/img690/956/gacnt.png

like image 2
Carlos Gutiérrez Avatar answered Nov 14 '22 21:11

Carlos Gutiérrez


I have developed a 3rd party service called embeddedanalytics. Uses the API. You can define charts of all sorts, geographical heat maps, and we have a simple widget giving key indicators for the month (visits, pageviews, bounce rate, etc).

This is an ideal service for someone not wanting to get into the programming aspects of the API. Simply define your chart and embed a snippet of code where you want the chart/object to show.

like image 1
M Schenkel Avatar answered Nov 14 '22 21:11

M Schenkel