Best way to collect basic visitor stats

For a personal project website I would like to collect some visitor stats, but…

  • Google Analytics: I don’t like because… it’s Google :wink: Addon seems to exist but don’t get it working as probably not compatible with Vaadin 24 (alpha), see
  • Matomo: I prefer because… it’s not Google :wink: But needs self-hosted instance or paid, so both costing extra money…

But I’m already using a database for my web app, so I could actually store a minimal number of items to have some kind of stats:

  • Country of visitor
  • Name (url?) of the visited page
  • Date/time
  • Previous page (referrer)

What would be the easiest way to achieve this with a class that can be extended by all my pages? Is there some way to get e.g. a @AfterPageLoad with this kind of session info?

BTW, a bit strange Vaadin itself doesn’t provide a way to add GA or Matomo, isn’t it?

You could implement AfterNavigationObserver

SessionInitListener can also be used.

Vaadin is NOT build for typical internet websites where those trackers are used/needed. In-house business application within the EU normally don’t like to track their user.

thanks @quirky-zebra indeed makes sense, maybe my use-case is bit non-vaadin-typical… website for/with my 12y drumming son:

Vaadin+Spring is the thing I know so in that view it makes sense

Don’t worry I would do the same :sweat_smile:

This is also Vaadin


indeed these can probably provide me some of the data I’m looking for.
any ideas about how to find the country of visitor, that’s probably the most difficult one?

I mean why shouldn’t you use it for a website?

exactly my idea :wink:

You could use a geolocation service like

Oh this is no longer free :thinking:

seems this one is

Google has this service too (btw. this would be the benefit if you use Google Analytics)

thanks for the info @adaptable-uakari @quirky-zebra , back to real work now and will check what I can do in non-work-time for this project :wink:

Seems I could also use

var session = VaadinSession.getCurrent();
        var request = VaadinRequest.getCurrent();"Session: {}", session.getSession().getId());"Remote IP: {}", request.getRemoteAddr());"Path info: {}", request.getPathInfo());

But getPathInfo is always “/”, strange…

If you need the URL

UI.getCurrent().getPage().fetchCurrentURL(url -> {
    // use the URL

This will be executed on the client.