Unique Site Visits

Hi!

I want to know the number of unique site visits.
What should be the best way to do this?
I tried to count from the sec$SessionLogEntry but this is only applicable for logged-in users.
Is there a way to keep track of anonymous users too?

Thanks!

1 Like

Most likely you need Google Analytics or another tracker.

There is a Vaadin add-on for that https://vaadin.com/directory#!addon/googleanalyticstracker You can add it to Maven dependencies of web module from Project properties - Advanced in CUBA Studio and then just use API provided by the add-on. You need version 3.x for CUBA 7.x

1 Like

Thanks Yuriy for the support.
I did try this path before… but I got stuck in getting the com.vaadin.ui.Window class.

When I tried this code below, I get an error:

Copy

    com.vaadin.ui.Window mainWindow = getWindow().unwrap(com.vaadin.ui.Window.class);

Error:
java.lang.ClassCastException: com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout cannot be cast to com.vaadin.ui.Window

What should be the correct way to get com.vaadin.ui.Window from the current window?