Endpoints :
- /hit/<endpoint>?custom_param1=...&custom_param2=... The url you want to hit to store the request. The all additional parameters will be stored in database as dictionnary and available in json stats in 'custom_data':{} key of each request.
- /endpoint_stats/<endpoint>?api_key=... The url to retirieve metrics a full database of requests on the endpoint in json format
Exemple of use :
If you want to know how much people are using your program, you just need to generate an endpoint, and make a get request to it at startup.
Same if you want to know how much people are using a specific feature, you just make a request to a generated endpoint each time someone is using it.
function store_visit(){
var x = new XMLHttpRequest();
x.onload = function() {
var resp = JSON.parse(x.responseText);
// if everything is okay, server response is {"OK":"Visit stored."}
}
x.open("GET","http://thaaoblues.pythonanywhere.com/hit/<endpoint_id>",true);
x.setRequestHeader('X-Referer', window.location.href);
x.send();
}