PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Alexander Skakunov   PHP Google Analytics API Metrics Tracker   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: documentation
Class: PHP Google Analytics API Metrics Tracker
Track accesses to your API using Google Analytics
Author: By
Last change: added a screenshot
Date: 8 years ago
Size: 1,467 bytes
 

Contents

Class file image Download

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

PHPclasses.org class content is here

The class is done for my yasno.tv project.

You can reach me at alex.skakunov@gmail.com .

Requirements

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.

Installation

  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:

    google.analytics.tracking.code = 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.

Notes

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