O'Reilly logo

APIs: A Strategy Guide by Dan Woods, Greg Brail, Daniel Jacobson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Operational Metrics

This section covers some guidelines for designing operational metrics.

The most successful web analytics tools, such as Google Analytics, work by running JavaScript inside the browser for each page to be tracked. This allows the analytics system to gather data about many aspects of the page and system, which helps offer deeper insight into the users’ behavior. They also can employ tracking mechanisms such as one-pixel “beacon” graphics to determine when a user views a certain page.

This technique doesn’t work for APIs. To start with, unlike a web page there’s no way for an API response to force the client to do anything. And although APIs are consumed by web applications running inside browsers, often they are also consumed by mobile devices, servers, and inside other environments where running JavaScript isn’t even possible.

(In a private API, on the other hand, the API provider sometimes has complete control over what happens in the client. In those cases, using techniques like JavaScript and beacon graphics to track usage is indeed possible.)

Instead, API analytics have to be generated on the server side – either inside the server that serves up the API traffic directly, or from a layer that sits in front of those servers. That means that certain pieces of information, such as the exact software version of the client, are not available unless the client sends a correct value in an HTTP header.

However, there is a rich set of data to mine inside API traffic. Since ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required