Main Content RSS FeedLatest Entry

PHP Google Analytics API

php-med-trans-lightGAPI 1.3 released this past month. First, read the Google Analytics Data API Reference and then read up on dimensions, metrics, and valid combinations of the two.  The quotas apply to a single web property, so each analytics profile (site1, site2, etc) are subject to their own individual quotas.   There is no per user account limit for accessing the API.    If you plan on making any kind of on demand application I suggest you query in bulk and cache the results locally (analytics is not real time anyways).

API Features

  • Supports CURL and fopen HTTP access methods, with autodetection
  • PHP arrays for Google Analytics metrics and dimensions
  • Account data object mapping - get methods for parameters
  • Report data object mapping - get methods for metrics and parameters
  • Easy filtering, use a GAPI query language for Google Analytics filters
  • Full PHP5 Object Oriented code, ready for use in your PHP application


Google Quotas

  • The quota applies to a single web property
  • 10,000 requests per 24 hours
  • 100 requests in any given 10-second period
  • A query is also limited to pagination limits of 10,000 entries per feed, with a default response of 1,000 entries


While the broad set of data they have is extremely useful to pull down to do your own processing on, I find the custom visitor segments with the API a lot more interesting.    If you have a user based site with registration and collect information on your users, you can pull this data back out to determine a lot of information about your user.   A lot of tools are already built into Analytics for reporting but the ability to mash this data up to provide custom reporting for your users (customers) without giving them access to analytics is key to delivering metrics and performance

Related Posts
  • Drupal Scaling, not so much After working on the migration this week and moving CitySquares.com over to a new environment we ended the week with a load test from Soasta. Starting at several hundred concurrent...
  • SEO: Taking control of search In my experience the majority of web agencies and developers still do not take search seriously enough.  Most businesses have very simple requests, "How do I show up for keyword...
  • Nuances of EC2 and RightScale So here it is, about two weeks have passed since CitySquares officially migrated its server infrastructure over to EC2 and RightScale. All in all, everything went relatively well. There were...

Recent Entries

SOLR Filtering Performance Increase

solr_fcA couple months ago I wrote about the terrible performance and a work around for SOLR / Lucene search engine. I discovered that performance would drop off a cliff while using filter queries to narrow search results for search queries on common terms in large indexes.  Although, it looks like the issue has been addressed in some of the latest nightly SOLR builds and is scheduled for official release with SOLR v1.4. Previous to this new version the filter queries were applied after the main query ran. This is all well and good but it doesn't help speed your query up like you think it should. The new version applies the filters in parallel to the main query significantly speeding up searches with common queries and query filters by 30% to 80% along with a 40% smaller memory footprint.

However, even with this speed improvement you still should consider how you structure your queries. There is no need to do a query across every field if you know you really want to filter everything down with a single filter query. Try moving that filter query (fq) into the actual query (q) as <field>:<filter>. You might be surprised by the results...

Related Posts

PHP Rapid Application Development with ZF1.8 and AR

php-med-trans-lightIn the days since I began programming in PHP the web has come a long way. With the 5.3 release of PHP, the OOP side of things are finally getting a much needed polish. In the past year there's been a steady rise in the usage of Ruby on Rails for web development as programmers are discovering that coming up with an idea for a site is far more enjoyable than programming one. Rails offers a very rapid application development environment to get from concept to code in a minimal number of steps. Unfortunately, PHP has been lacking in this regard. PHP needs a standard framework and easy database interaction. Currently, the steps required to go from concept to code brings with it a huge overhead in scaffolding development.

It is precisely this overhead that needs to be eliminated. Time is money and if you are working with a new application on a weekly or monthly basis the scaffolding overhead comprises a great deal of that time. Not to mention that most web applications today are running to and fro from a database. This time spent fetching and storing data makes up for a significant chunk in the overall development. 2009 is a big step forward for PHP and there are tools out there that tackle this problem.

Read More..

Related Posts
  • Digging into HAProxy Well its been a few weeks since my last posting here and there is certainly a good reason for that. Every once in a while I just need to completely...
  • PHP on Rails Adding conventions to DRY our code This article will provide a few snippets of code that I have recently plugged into the custom PHP framework that I use. However, those...
  • PHP Google Analytics API GAPI 1.3 released this past month. First, read the Google Analytics Data API Reference and then read up on dimensions, metrics, and valid combinations of the two.  The quotas apply...

PHP ActiveRecord Available for Beta Testing

php-med-trans-lightWe've been working hard to get this ready for people to start poking around in and we're happy to announce that it's now ready for public beta testing! You can grab it from http://github.com/kla/php-activerecord/. Play with it... break it... and give us your feedback to help us make a better library for everyone! We want to hear from you.

Quick Start

We'll start first with a bare bones example to show how little you need to get up and running. There's very little to configure. We've adhered to the convention over configuration philosophy so there are no code generators you need to run and no xml/yaml mapping files to maintain.

Read More..

Related Posts
  • PHP on Rails - The Flash Last week I wrote an article about extending my framework (Pho framework courtsey of Kien La) to DRY your code and to be more similar to Rails. Today, I would...
  • Amazon's EBS (Elastic Block Store) I wrote just yesterday about running your own hardware vs. using EC2 and RightScale and one of the major issues I found with EC2 was the lack of a persistent...
  • PHP ActiveRecord with PHP 5.3 Update! Find the latest here. PHP 5.3 gets ActiveRecord! A quick search to find an implementation of active record for php on google is discouraging when one considers the state...

PHP ActiveRecord with PHP 5.3

Update!

Find the latest here.

PHP 5.3 gets ActiveRecord!

php-med-trans-lightA quick search to find an implementation of active record for php on google is discouraging when one considers the state of ActiveRecord for Ruby on Rails. The reader will notice that the top results are from very old posts and the rest of the results preview minimial implementations. Of course, eventually, PHP will see a robust active record similar to RoR. Fortunately, that time is now, thanks to PHP 5.3 and the beneficial new features: closures, late static binding, and namespaces.

My friend Kien and I have improved upon an earlier version of an ORM that he had written prior to PHP 5.3. The ActiveRecord we have created is inspired by Ruby on Rails and we have tried to maintain their conventions while deviating mainly because of convenience or necessity. Our main goal for this project has been to allow PHP developers tackle larger projects with greater agility. However, we also hope that use of this resource will push the PHP community further by learning the wonderful benefits of the Ruby on Rails stack. Enough with the rambling, let's get to the interesting piece!

Read More..

Related Posts