Important facts about commercial licenses

  • Licenses are perpetual. They do not expire and do not need to be renewed.
  • Licenses can be upgraded. You can upgrade to a more expensive license later paying only the difference in cost.
  • Pay attention to the distribution type - Hosted (sites / servers), binary (applications) or source (includes all the others). Choose according to your needs (more below).
  • All licenses allow commercial use unless otherwise indicated.
  • Read the full license by clicking on the icon.
  • Read more about licenses in our handy license guide.
Free

Apache License, 2.0

The Apache License, 2.0 is an
open-source license.
You need to log-in or create an account
  • Create an account
  • Log-in
  • Please use your real name.
  • Account activation link will be sent to this address.
  • Minimum 8 characters

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

  • Released: Mar 3, 2011
    Last Update: Mar 3, 2011
  • Language: PHP
  • Category: Statistics
(4 ratings)

Google Analytics PHP Library

Google Analytics PHP Library
Developed by Alon Carmel, Released Mar 3, 2011

Google analytics library for reporting server side

PHP

Used to track usage inside your php web application, you can add hooks to report to 'pages' on google analytics to track users action inside your app.

Very useful.

EXAMPLE:

    // Initilize GA Tracker
    $tracker = new GoogleAnalyticsTracker('UA-XXXXXXXX', 'myanalyticsdomain.com');
    // Assemble Visitor information
    // (could also get unserialized from database)
    $visitor = new GoogleAnalyticsVisitor();
    $visitor->setIpAddress($_SERVER['REMOTE_ADDRESS']);
    $visitor->setUserAgent($_SERVER['HTTP_USER_AGENT']);
    $visitor->setScreenResolution('1024x768');

    // Assemble Session information
    // (could also get unserialized from PHP session)
    $session = new GoogleAnalyticsSession();

    // Assemble Page information
    $page = new GoogleAnalyticsPage('/analytics/yourfakepage');
    $page->setTitle('fake page topic');

    // Track page view
    $tracker->trackPageview($page, $session, $visitor); 

Lega note: This is NOT developed by alon carmel originally. its developed by http://code.google.com/p/php-ga/ by Thomas Bachem tb@unitedprototype.com. i just modified the code to work without namespaces using php5.x and not 5.3and up. all the rights belong to thomas bachem.

View all 3 reviews »

User Reviews

  • Chris Bearcroft 1 year ago
    A very good set of classes, nicely documented and commented.
    Flag
    Was this helpful? Yes No
  • david peribaƱez 4 weeks ago
    A very good port. Just configure the autoload and it will work.
    Flag
    Was this helpful? Yes No
  • fulgorek 1 year ago
    This is a nice class and very useful, but had some issues:
    since is a port from an open source project need more improvements to make it unique, also the documentation is crappy (or inexistent).
    Flag
    Was this helpful? Yes No

Questions & Comments


Or enter your name and Email
No comments have been posted yet.
You must be logged-in to vote. Log-in to your account or register now.