Tracker blocking would explain some of this (though my experience is that it's <10% of traffic, though I'm dealing with a lot more than 20 visitors pr. day). Your JS solution is unnecessary though for first-party tracking, just parse your server logs.