Ahoy
Simple, powerful, first-party analytics for Rails
...The library supports Rails, JavaScript, and native apps, making it flexible across front-end/back-end and mobile contexts. Because it’s designed for developers who already own their data stack, Ahoy encourages self-hosted analytics workflows, custom reporting, and integration with existing database infrastructure. It includes features for tracking visits (sessions), events (actions), and user properties, so you can introspect user journeys and behaviour within your application domain.