PHP API上的分析

I recently completed my first API in PHP. It is hosted at a public URL and accessed by a couple of my own mobile apps and websites. Based on a couple of parameters passed in, it pulls some data from my database and returns some JSON.

I would like to know some details about how often the API is accessed, and by what kind of clients.

Can I use google analytics for this? I have used it successfully on some websites in the same domain, but when I include the analytics php link and access the API, nothing is recorded.

Any gotchas I could be missing? Or is Google analytics only useable on web pages?

Google analytics isnt just for montiring websites, you can also use it to monitor mobile applications.

You might be able to monitor your API with the Measurement Protocol this should let you send info about the preformance of your api, and log the things you are talking about.

Note: I havent tried it but would love to hear from you if this works.