public function trackEvent($id, $eventName, $additionalParams = [], $isSystem = true)
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        if (!$eventName) {
            throw new InvalidArgumentException;
        }

        $params = [
            'event' => $eventName,
            'params' => json_encode($additionalParams)
        ];
        if (!$isSystem) {
            $params['by_user_id'] = 'true';
        }

        $res = $this->call('users/' . $id . '/events', $params, 'post');

        if ($res && isset($res['id'])) {
            return true;
        }

        return false;
    }
public function trackEvent($id, $eventName, $additionalParams = [], $isSystem = true)
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        if (!$eventName) {
            throw new InvalidArgumentException;
        }

        $params = [
            'event' => $eventName,
            'params' => json_encode($additionalParams)
        ];
        if (!$isSystem) {
            $params['by_user_id'] = 'true';
        }

        $res = $this->call('users/' . $id . '/events', $params, 'post');

        if ($res && isset($res['id'])) {
            return true;
        }

        return false;
    }
public function trackEvent ( $ id , $ eventName , $ additionalParams = [ ] , $ isSystem = true ) { if ( $ this -> isEmptyId ( $ id ) ) { throw new InvalidArgumentException ; } if ( ! $ eventName ) { throw new InvalidArgumentException ; } $ params = [ 'event' => $ eventName , 'params' => json_encode ( $ additionalParams ) ] ; if ( ! $ isSystem ) { $ params [ 'by_user_id' ] = 'true' ; } $ res = $ this -> call ( 'users/' . $ id . '/events' , $ params , 'post' ) ; if ( $ res && isset ( $ res [ 'id' ] ) ) { return true ; } return false ; }
Tracking events, which is performed by the user.

@param $id - user ID
@param $eventName
@param array $additionalParams

@return bool

@throws InvalidArgumentException
Tracking events which is performed by the user .