Check Countly's [1] open source Community Edition [2] which can be deployed on a Digital Ocean instance easily [3]. Also here [4] is an explainer video you may want to check.
[1] https://count.ly
[2] https://github.com/countly/countly-server
[3] https://marketplace.digitalocean.com/apps/countly-analytics
[4] https://youtu.be/sQCUNSzfEW8