private function getCommonParams($config, $userId, $attributes)
    {
        $visitor = [
            SNAPSHOTS=> [],
            VISITOR_ID => $userId,
            ATTRIBUTES => []
        ];

        $commonParams = [
            ACCOUNT_ID => $config->getAccountId(),
            PROJECT_ID => $config->getProjectId(),
            VISITORS => [$visitor],
            REVISION => $config->getRevision(),
            CLIENT_ENGINE => self::SDK_TYPE,
            CLIENT_VERSION => self::SDK_VERSION,
            ANONYMIZE_IP => $config->getAnonymizeIP(),
            ENRICH_DECISIONS => true
        ];

        if (!is_null($attributes)) {
            foreach ($attributes as $attributeKey => $attributeValue) {
                // Omit attributes that are not supported by the log endpoint.
                if (Validator::isAttributeValid($attributeKey, $attributeValue)) {
                    $attributeEntity = $config->getAttribute($attributeKey);
                    if ($attributeEntity instanceof Attribute) {
                        $feature = [
                            ENTITY_ID => $attributeEntity->getId(),
                            KEY => $attributeKey,
                            TYPE => CUSTOM_ATTRIBUTE_FEATURE_TYPE,
                            VALUE => $attributeValue
                        ];

                        $commonParams[VISITORS][0][ATTRIBUTES][] = $feature;
                    }
                }
            }
        }

        // Append Bot Filtering attribute
        $botFilteringValue = $config->getBotFiltering();
        if (is_bool($botFilteringValue)) {
            $feature = [
                ENTITY_ID => ControlAttributes::BOT_FILTERING,
                KEY => ControlAttributes::BOT_FILTERING,
                TYPE => CUSTOM_ATTRIBUTE_FEATURE_TYPE,
                VALUE => $botFilteringValue
            ];

            $commonParams[VISITORS][0][ATTRIBUTES][] = $feature;
        }

        return $commonParams;
    }
private function getCommonParams($config, $userId, $attributes)
    {
        $visitor = [
            SNAPSHOTS=> [],
            VISITOR_ID => $userId,
            ATTRIBUTES => []
        ];

        $commonParams = [
            ACCOUNT_ID => $config->getAccountId(),
            PROJECT_ID => $config->getProjectId(),
            VISITORS => [$visitor],
            REVISION => $config->getRevision(),
            CLIENT_ENGINE => self::SDK_TYPE,
            CLIENT_VERSION => self::SDK_VERSION,
            ANONYMIZE_IP => $config->getAnonymizeIP(),
            ENRICH_DECISIONS => true
        ];

        if (!is_null($attributes)) {
            foreach ($attributes as $attributeKey => $attributeValue) {
                // Omit attributes that are not supported by the log endpoint.
                if (Validator::isAttributeValid($attributeKey, $attributeValue)) {
                    $attributeEntity = $config->getAttribute($attributeKey);
                    if ($attributeEntity instanceof Attribute) {
                        $feature = [
                            ENTITY_ID => $attributeEntity->getId(),
                            KEY => $attributeKey,
                            TYPE => CUSTOM_ATTRIBUTE_FEATURE_TYPE,
                            VALUE => $attributeValue
                        ];

                        $commonParams[VISITORS][0][ATTRIBUTES][] = $feature;
                    }
                }
            }
        }

        // Append Bot Filtering attribute
        $botFilteringValue = $config->getBotFiltering();
        if (is_bool($botFilteringValue)) {
            $feature = [
                ENTITY_ID => ControlAttributes::BOT_FILTERING,
                KEY => ControlAttributes::BOT_FILTERING,
                TYPE => CUSTOM_ATTRIBUTE_FEATURE_TYPE,
                VALUE => $botFilteringValue
            ];

            $commonParams[VISITORS][0][ATTRIBUTES][] = $feature;
        }

        return $commonParams;
    }
private function getCommonParams ( $ config , $ userId , $ attributes ) { $ visitor = [ SNAPSHOTS => [ ] , VISITOR_ID => $ userId , ATTRIBUTES => [ ] ] ; $ commonParams = [ ACCOUNT_ID => $ config -> getAccountId ( ) , PROJECT_ID => $ config -> getProjectId ( ) , VISITORS => [ $ visitor ] , REVISION => $ config -> getRevision ( ) , CLIENT_ENGINE => self :: SDK_TYPE , CLIENT_VERSION => self :: SDK_VERSION , ANONYMIZE_IP => $ config -> getAnonymizeIP ( ) , ENRICH_DECISIONS => true ] ; if ( ! is_null ( $ attributes ) ) { foreach ( $ attributes as $ attributeKey => $ attributeValue ) { // Omit attributes that are not supported by the log endpoint. if ( Validator :: isAttributeValid ( $ attributeKey , $ attributeValue ) ) { $ attributeEntity = $ config -> getAttribute ( $ attributeKey ) ; if ( $ attributeEntity instanceof Attribute ) { $ feature = [ ENTITY_ID => $ attributeEntity -> getId ( ) , KEY => $ attributeKey , TYPE => CUSTOM_ATTRIBUTE_FEATURE_TYPE , VALUE => $ attributeValue ] ; $ commonParams [ VISITORS ] [ 0 ] [ ATTRIBUTES ] [ ] = $ feature ; } } } } // Append Bot Filtering attribute $ botFilteringValue = $ config -> getBotFiltering ( ) ; if ( is_bool ( $ botFilteringValue ) ) { $ feature = [ ENTITY_ID => ControlAttributes :: BOT_FILTERING , KEY => ControlAttributes :: BOT_FILTERING , TYPE => CUSTOM_ATTRIBUTE_FEATURE_TYPE , VALUE => $ botFilteringValue ] ; $ commonParams [ VISITORS ] [ 0 ] [ ATTRIBUTES ] [ ] = $ feature ; } return $ commonParams ; }
Helper function to get parameters common to impression and conversion events.

@param $config ProjectConfig Configuration for the project.
@param $userId string ID of user.
@param $attributes array Attributes of the user.

@return array Hash representing parameters which are common to both impression and conversion events.
Helper function to get parameters common to impression and conversion events .