PHP Classes

PHP Google Analytics API Metrics Tracker: Track accesses to your API using Google Analytics

Recommend this page to a friend!
  Info   View files Documentation   Screenshots Screenshots   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (2)    
Ratings Unique User Downloads Download Rankings
StarStarStar 58%Total: 226 All time: 8,199 This week: 524Up
Version License PHP version Categories
ga-api-tracker 1.0.0BSD License5.0PHP 5, Statistics, Web services


This class can track accesses to your API using Google Analytics.

It is a plugin for Zend Framework controller that send requests to Google Analytics API to record accesses to an API or Web pages implemented with the Zend Framework.

The class can track information about each request IP address, accept language and client ID using a cookie.

Innovation Award
PHP Programming Innovation award nominee
October 2015
Number 4

Prize: One year server license IP to country, region, city, latitude, longitude, ZIP code, time zone, area code database
Google Analytics is a very popular service used by many sites to track the audience of their Web pages.

However, it also provides an API that allows you to keep track of other types of events.

This package uses the Google Analytics API to keep track of the accesses to an API provided by a PHP site.

Manuel Lemos
Picture of Alexander Skakunov
Name: Alexander Skakunov is available for providing paid consulting. Contact Alexander Skakunov .
Classes: 9 packages by
Country: Ukraine Ukraine
Age: 42
All time rank: 232 in Ukraine Ukraine
Week rank: 225 Down4 in Ukraine Ukraine Down
Innovation award
Innovation award
Nominee: 3x

Winner: 1x


This class helps to track your backend application usage in Google Analytics -- the requests made to your backend are logged in Google Analytics.

this is how it looks

Technically it uses the Mobile Tracking class content is here

The class is done for my project.

You can reach me at .


The class is based on Zend Framework 1, so if you don't want to use it, the request\response\cookies management must be re-implemented in this class.


  1. Register at Google Analytics and get a tracking ID that looks like "UA-111111-11"
  2. Edit your application config and paste this line: = UA-111111-11

  3. make sure you add this plugin in application/Bootstrap.php:

    protected function _initPlugins() { $front = Zend_Controller_Front::getInstance(); $front->registerPlugin(new Yasno_Controller_Plugin_Integration_Google_Analytics_Mobile_Tracker); }

That's it. You will have your backend script usage stats in Google Analytics in a while.


Clients of your API can set parameter "partner-id" and that will be used to track different users.

  • 1aaf13e8d7c06287eb4852be78f23248.png
  Files folder image Files  
File Role Description
Accessible without login Plain text file Doc. documentation
Plain text file Tracker.php Class the class

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,199
This week:524Up
 User Ratings  
 All time