Counting a page view/visit is a surprisingly messy business. On one side of the spectrum, you can count every time a user visits a page. This way even a page refresh counts as unique visit. On the other hand, you can use fingerprinting, cookies and other techniques to track all users' actions on the web-site and determine if user’s return to the page qualifies as a new view.
To abide with our principles we chose the first approach and do not track users at all and stay at the privacy-oriented side of the spectrum. We plan to add privacy-conscious cookies to allow for a richer logic in the near future.
You can start counting visits in three simple steps:
Register [↪]. Here you will need to provide only your email and you will get an access code there. No need for passwords.
Create a counter using its domain name. All data gathered will be related to a counter. You may have any number of counters.
To record a visit you need to send a post request to the following endpoint: https://app.countina.io/api/v1/count/?counter=[COUNTER_KEY]&url= + url or string you want to attribute the visit to. You can copy ready to use url in the counter view after you log in:
The key is not secret and is used only to identify the counter. It cannot be used to access your account.
The body of the request should be empty. In return you get a raw int with current number of visits to the provided url in this counter, including the visit in question.
For instance this code is used on this page to record visits in this web-site:
|
|
Sometimes you need to get number of visits without changing it. You can do it by accessing the following url with a GET request: https://app.countina.io/api/v1/visits/?counter=[COUNTER_KEY]&url= + url in question. In return you will get number of visits to this url for this counter.
This endpoint is open and accessible to anyone, so the information about number of visits is not restricted by default.
By default the counter will accept as url any arbitrary string, regardless if it is a valid url or not. This includes url to a different site (other than the domain of the counter). You can restrict recording visits only to urls which belong to the same domain as the counter.
This way all other urls will be ignored.