• Why I Wrote Laravel Simple Analytics

    Like a lot of developers, I've installed analytics on almost every project I've built. Sometimes that meant Google Analytics. Other times it meant looking at privacy-focused services like Plausible or Fathom. For Laravel applications, there are also great packages that integrate with those services.

    The problem wasn't that those tools were bad. The problem was that I didn't always need everything they offered. Sometimes I just wanted to answer simple questions.

    • How many times has this page been viewed?
    • How many users clicked this button?
    • Which pages are visited the most?
    • How often is a particular event happening?

    I didn't need dashboards full of charts, visitor sessions, marketing funnels, or third party integrations. I just wanted some counts.

    #Keeping It Simple

    That was the motivation behind Laravel Simple Analytics.

    The package records page views and custom events directly in your application's database. From there, you can query the data however you want.

    Need to know how many people viewed your pricing page this week?

    Easy.

    Want to know how many users clicked a "Start Trial" button?

    Track it with a single line of code.

    Sometimes that's all you need.

    #Why Not Just Use Google Analytics?

    Google Analytics is a fantastic product, but it solves a much larger problem. If you're running a marketing website and want detailed visitor insights, campaign tracking, demographics, and conversion reports, it makes perfect sense.

    For many internal tools and smaller applications, though, that information isn't always useful. Sometimes I just need to know whether a feature is being used. I don't need another dashboard. I already have one. It's my application.

    #Building for the 80 Percent Case

    One thing I've learned over the years is that not every project needs an enterprise solution. There is value in software that does one thing well. Laravel itself embraces this philosophy. It gives you sensible defaults while staying out of your way. I wanted this package to feel the same way.

    1. Install it.
    2. Add the middleware.
    3. Track a few events.

    Move on with your project.

    #It Is Also a Good Starting Point

    One thing I like about keeping packages small is that they're easy to understand. If someone wants to customize the tracking logic or build additional reporting on top of it, they can. The package isn't trying to own your analytics strategy. It simply provides a lightweight foundation.

    #Check It Out

    If this sounds useful, you can find the project on GitHub:

    Laravel Simple Analytics

    Feedback, issues, and pull requests are always welcome.

    Sometimes the best package isn't the one with the most features. Sometimes it's the one that solves exactly the problem you have.

    profile image of Justin Thomas

    Justin Thomas

    Justin Thomas is a software engineer who enjoys building useful things on the internet. He’s the creator of Solic.io, a tool that helps websites reduce spam and surface real conversations. He writes about coding, product development, and the realities of shipping software.

    More posts from Justin Thomas