Analytics Service for Live View

I’ve been thinking about analytics with my own website lately. Originally I started out with Google Analytics. The thing I liked the most about this was checking out referrals and looking at the map to see what part of the world the traffic is coming from.

But then I listened to this episode of the Changelog:

It covered a number of topics. Some points that resonated with me:

  • Google Analytics is not lightweight
  • Privacy/tracking issues
  • Cookie-less option

Some time later, I read this post from Jose:

This was before fly.io. Setting up my own Plausible server for a side project seemed fun, but not something I want to maintain (and ultimately would add cost). So, I decided to rip out Google Analytics and just stick with my users table - which records the user’s timezone (based on the user’s IP address).

For me, this has been enough. However, I recently came across https://splitbee.io. For a low traffic website such as mine, this gives me a nice UI to inspect similar (yet probably more accurate) information. I also really enjoyed the onboarding process.

So I started thinking about analytics again - this time from a technology/product point of view (i.e. not making a personal decision based on cost).

This is a naïve thought - but could you make an analytics solution that is designed to work exclusively with Live View? I’m assuming through the Live View life cycle that a javascript call is being made per page render to the Phoenix server anyway. So could you piggy-back on that to achieve similar functionality to a traditional javascript Page Tagging solution (such as Google Analytics).

Specifically, I was thinking you could create a pub-sub communication model between the web application and the analytics service. The thought of an Elixir-centric solution in my web app is appealing and this feels like it carries on the spirit of Live View - i.e. there is javascript but you don’t have to think about it. I like the onboarding experience with Splitbee too - I could see a similar experience, but with an Elixir-based product. I’m not sure if there would be any other benefits to such a solution (above and beyond a traditional javascript solution) or even this is a good idea! Just thought I’d see what other people think.

Finally, and this is a self-serving question, is this something that people would be interested in? The existing solutions out there are already fantastic! Would you pay for such a thing?

4 Likes

I’ve been thinking about making something similar to this. Essentially it would be similar to the ahoy gems in Rails, but fully GDPR out of the box, and focused entirely on marketing analytics (views not associated with any given user).

One would add the package, then generate the required migration files to run, which would add two tables “visits” and “sessions”. Then one would need to wire up the LiveView mount lifecycle to send an event to the application that would be in charge of computing a hash of salt + ip + user_agent and storing the visit in the table (similar to plausible.io).

For viewing the dashboard, the package would also have a Live Dashboard plugin that would show the basic stats that most people care about.

It seems like it would be quite useful. My motivation for the above idea is to provide a turn-key solution that covers what most simple Phoenix sites would need without needing to sign up for external services which are not needed if one already has a perfectly functioning (Postgres) database.

With regards to your larger question as to whether the LiveView aspect of things and a better integration with Elixir constitutes a better paid product, I’m not so sure. Most analytics services provide an event API which one could send events to as an alternative to their default JS script you would otherwise include.

4 Likes

I like what you’re suggesting. I think it fits in very well with the idea of a side-project. All I want is a nice UI to see some simple analytics.

Yeah I think you’re right about the paid product aspect. Onboarding and ease of use is important once you have a potential customer. But I’m not sure that the Live View aspect is enough to justify why you might choose such a service - unless there was some sort of technical advantage/new feature no one has seen before.

Though, maybe you could provide users with their own self-hosted/simple version (to put in their project) and make it easy to transition to a cloud-hosted solution when they see fit…

1 Like