Is there a Google Analytics-like solution to track

2019-03-09 16:03发布

Just wondering if there's any out of the box solution for this, I am not too familiar with the analytics api maybe I can write some simple js that updates analytics before going to my service etc. -- otherwise I am going to have to stick to the good old 'store records in the database'.

Any help appreciated!

8条回答
迷人小祖宗
2楼-- · 2019-03-09 16:36

I think this solution might be a really good choice if you're interested in specifically tracking REST calls: http://apianalytics.com It looks like it has everything you'd need. A bit like the Mixpanel of APIs.

Disclaimer: A good friend of mine has built this

查看更多
劫难
3楼-- · 2019-03-09 16:38

What information are you looking for specifically? You might be able to get what you need from http access logs.

查看更多
Bombasti
4楼-- · 2019-03-09 16:40

You could do this now with GA using the new Measurement Protocol the is currently in public beta.

查看更多
\"骚年 ilove
5楼-- · 2019-03-09 16:41

I think Keen IO would be a great fit here. It's an API-only analytics platform (meaning that you both send data and consume analysis via a REST API).

Full disclosure: I'm the CEO. I'm not writing this answer to self-promote, but because honestly, our product was purpose-built for use cases like yours.

Several Keen IO users are API companies who use it to do analytics on how their users are using their APIs.

At the risk of being a bit too meta: We use the Keen IO API internally to collect events and perform analysis of how our customers use the Keen IO API externally, and by way of example, our two-event data model looks something like this:*

  • analysis_call
    • request (object)
      • client_library_version (string)
      • API_version (number)
      • query_parameters (key-value object)
      • post_parameters (key-value object)
      • origin_ip (ip address)
      • URI (string)
    • num_events (integer)
    • includes_geolocation (boolean)
    • user_agent (string)
    • response (object)
      • HTTP_code (number)
      • latency (number)
      • headers (object)
      • body (object: the actual full JSON response object, if under 1K)
  • events_added_call
    • client_library_version (string)
    • API_version (number)
    • origin_ip (ip address)
    • request (object)
    • response (object: the actual full JSON response object)

*We actually use a lot more properties than this, I've stripped them out to make this more clear

查看更多
放我归山
6楼-- · 2019-03-09 16:45

I don't think google analytics can track rest calls, because it's activated by a snippet of JavaScript that you embed in your HTML.

To view the logs, you can go to the appengine console, choose your application and select Logs.

To access your logs programmatically, you've to download them (with Java, with Python), but it seems that up to now you can't do it within your app engine, so you've to do it either on your workstation or maybe on an Amazon EC2 (maybe micro) instance.

On the other hand, if you decide to store records in the DataStore, do the update within a task queue, so you don't slow down your API (Task Queues with Java, Task Queues with Python).

查看更多
我欲成王,谁敢阻挡
7楼-- · 2019-03-09 16:49

There seem to be a few solutions out there, though they mostly seem to involve changing your API architecture.

You could potentially use one of the Google Analytics server-side tracking libraries.

I see you're using AppEngine; I also run an API using AppEngine, and recently have been playing with using a Google Analytics Library for App Engine. It's not a perfect solution, but there's a decent amount of quality data.

Be warned that Google Analytics data modeling really isn't that analagous to that of an API; depending on your API, the notion of a "visit" is somewhat meaningless.

查看更多
登录 后发表回答