code looks good to me, and the user_id = ? addition makes sense to me after thinking about it. might be good to have a test (if current tests aren't already affected), otherwise looks good to me.
@diosmosis I'll merge for now. We'll see what comes out of https://github.com/matomo-org/developer-documentation/pull/320 re forcing new visits