public function setUserId($userId)
    {
        if ($userId === false) {
            $this->setNewVisitorId();
            return $this;
        }
        if ($userId === '') {
            throw new Exception("User ID cannot be empty.");
        }
        $this->userId = $userId;
        return $this;
    }
public function setUserId($userId)
    {
        if ($userId === false) {
            $this->setNewVisitorId();
            return $this;
        }
        if ($userId === '') {
            throw new Exception("User ID cannot be empty.");
        }
        $this->userId = $userId;
        return $this;
    }
public function setUserId ( $ userId ) { if ( $ userId === false ) { $ this -> setNewVisitorId ( ) ; return $ this ; } if ( $ userId === '' ) { throw new Exception ( "User ID cannot be empty." ) ; } $ this -> userId = $ userId ; return $ this ; }
Force the action to be recorded for a specific User. The User ID is a string representing a given user in your system.

A User ID can be a username, UUID or an email address, or any number or string that uniquely identifies a user or client.

@param string $userId Any user ID string (eg. email address, ID, username). Must be non empty. Set to false to de-assign a user id previously set.
@return $this
@throws Exception
Force the action to be recorded for a specific User . The User ID is a string representing a given user in your system .