This API allows you to create simple numeric counters.
It goes as:
- Create a counter and restrict its operations
- Reset the value of a counter
- Increment / Decrement a counter
All counters are accesible if you know the key and there are not private counter.
Want to track the number of hits a page had? Sure. Want to know the number of users that clicked on the button "View More"? There you go.
https://localhost:8080/hit/:NameSpace/:Key
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://localhost:8080/hit/example.com/visits");
xhr.responseType = "json";
xhr.onload = function() {
console.log(this.response.value);
}
xhr.send();
$.getJSON("https://localhost:8080/hit/example.com/visits", function(response){
console.log(response.value);
})
if you want to have a counter for each individual page you can replace visits with a unique identifier for each page, i.e index, contact, item-1, item-2.
Keys and namespaces must have at least 3 characters and less or equal to 64.
Namespaces are meant to avoid name collisions. You may specify a namespace during the creation of a key. Its recommend use the domain of the application as namespace to avoid collision with other websites.
If the namespace is not specified the key is assigned to the default namespace. If your key resides in the default namespace you don't need to specify it.
All requests support cross-origin resource sharing (CORS) and SSL.
Base API path: https://localhost:8080
This endpoint will create a key if it doesn't exist and increment it by one on each subsequent request.
Get the value of a key.
Set the value of a key.
made by Asadbek Karimov