In addition to the new wordpress plugin, today we’re also releasing version 4 of our analytics API. We’ve got some really great new features outlined below. Full documentation is here.
- Segmentation data! Example: Summary data + top countries and web browsers for visitors from twitter.com over the last 7 days
- Data for individual items (e.g. a specific country or search term). Note, this is different than the existing “filter” parameter, which is a wildcard (i.e., slow) match. This is an exact match string and hence very quick. Example: Daily hits from google.com
- Hourly data for supported data types (visitors and actions) Example: hourly data for both visitors and actions over the last 7 days
- Option to specify only the fields you want returned for type=visitors-list. This is a big one because we have a number of users who export their entire visitors-list every day. They may only want a few fields, but had to get all of them no matter what. If this applies to you, this new option will vastly speed up the response time for visitors-list queries. Example: Only return IP, session ID, landing page, location, and browser
- Proper error responses. It’s hard to believe that up until now, a bad request would just return completely empty. How helpful of us! Now, if there are any problems with your request, an error will be output. Example: Forgetting the required “type” parameter. XML PHP JSON
- The XML parent element has been changed from “items” to the more standard “response”. This parent element also has a new attribute, “status”, whose value will either be “ok” or “fail”. If it is “fail”, there is an error with your request. The XML document will then have just one element, “error”, whose value will be the error message. For PHP and JSON, which both return arrays, the array will only have one item, whose key will be “error” and whose value will be the error message.
- We’ve added a ton of inline examples throughout the documentation, so instead of perhaps being confused about what a certain feature does, you can just click a link and instantly see an example.
The two big features for us are segmentation, and being able to specify a individual items. With these, and everything else, we feel the API is much stronger than v3.
We like APIs. They’re neat.
We’re going to be adding some more APIs in the near future that let you get information about your account, as well as the ability to write data to Clicky, instead of just reading from it. For example, registering new sites, updating site preferences, creating goals, etc.
We’re releasing one today as a sneak peak. This is something that those of you with lots of sites may find quite useful. It’s called “sites”. (We’re really creative). Pass it your username and password, and it will return to you all of the sites in your account, including their domain name, nickname, site_id, sitekey, sitekey_admin, and database server.
For example, here’s a pretend account I just registered.
And with PHP output:
Happy Halloween weekend!
Don’t drink too much! We’ll see you in November.