Store your visitor's ip addresses, then query analytics on them
{
"version": "v0.1.4",
"patchNotes": [
"Added multiple app support (separate lists of IPs)",
"Added configurable max results size in list requests"
]
}- This app runs in the background listening for requests of IP address logs. Whenever a visitor loads your frontend, send a request to this app with their IPv4 address to log their visit.
- Please only log the initial visit, not every page load
- With only these IP logs, this app will provide data about your website's visitors, such as:
- Visitor frequency / return rate
- Geographical location
- Likelihood of being a bot
- With enough aggregated data, the app will generate more analytics, such as:
- Most common geographical locations
- Average time between repeated visits
- Average new unique visits per month
- Clone this somewhere & configure the settings in
resources/config/config.json:maxResultsAllowed: maximum number of results allowed in list requests. Larger numbers mean more accurate data but more load on the app.minutesTillDuplicateIpCacheClear: the app will normally reject duplicate requests. This is how often the app will forget it's last requests.
- Configure the port that the app will use in
resources/application.yml - Deploy on a cloud host or server in the same network as your other apps (sorry this isn't more specific)
- Configure your firewall so only apps on your network can communicate with this app
- It is only really important that your frontend sites can reach this app
- If you would like extra security, you can setup a backend or proxy to relay requests to and from this app.
- Optional: Run this app with env var
APP_AUTH_TOKENset to whatever string you'd like in order to password protect it.
- Whenever a visitor first loads your website, get their IPv4 and send a request like this:
POST /ip/log?address=<their IP>&app_id=<name of website>- name of website is just any unique id for your website.
- this allows you to use this app for multiple of your websites on the network.
- Over time data will be collected on your various app visitors.
- See the swagger docs to familiarize yourself with the different requests you can make on this data.
- Note: If you gave the app an auth token during setup, you'll need to include that when making any request.
- Add an
Authorizationheader in the format:Basic <APP_AUTH_TOKEN>, filling in the token with whatever you used earlier
- Add an