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?
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