How to hook into "visiting the website"? My main problem is very similar to How to grant userpoints to users who perform a login 5 days consecutively?. As Mike correctly notices in his answer on that question, his solution will not work for users who leave their browser logged in. Therefore, I do not want to hook into a login, but into "visiting the website" (i.e. accessing any page).

I am fine with both Rules and custom code. In the first case, which Rules event can I use? For performance reasons, it is in both cases desirable that the hooking takes place as few times as possible (in the best case once a day per visiting user). Is restricting the visited page to a particular one, say, the homepage the only way to achieve that?
Using Rules Event "Drupal is initializing" (within "System") for sure will do the job:


It doesn't depend on login (can be used for any role).
It applies to any path (a node, a view, etc).


Should you want to do so, you can also add any desired Rules Conditions (eg to only consider selected paths, eventually using RegEx expression also).

Make it right before you make it better

I'm not sure this is the only way your question can be answered, but I do know that this Rules Event (Drupal is initializing) will do what you're asking for, which is to hook into "visiting the website" (i.e. visiting any page) (as in your question).

But, using this Rules Event also comes with a price: it will case this rule to be triggered on every page request (which is a pretty similar to your visiting any page). However, if this price is too high, maybe you want to consider any (or all?) of these compromises:


Add Rules Conditions such as "only for users with selected roles" (eg: authenticated, so that for Anonymous users the Rules Actions are not triggered).
Instead of any page, you only take into consideration something like "viewing content" (for which you know there are less expensive Rules Events available).