A better way to get stats

You’ve got one very large issue here – you’re using $_SESSION.

WordPress, by default, doesn’t use session variables. So isset( $_SESSION['vsp_user'] ) will always return false because WP isn’t keeping track of things.

There are some additional changes you’ll need to make and hooks you’ll need to tie in to in order to enable sessions in WP. Just to get you started, here are some resources:

Once you’ve actually got sessions turned on, you should see far less “false positives” in your stat tracking.