Return Types & DTOs

PHP DTOs and backed enums

PHP DTOs (Data Transfer Objects) and backed enums used by the SDK.

DTOs (Readonly Classes)

BucketedVariation

Returned by runExperience() and runExperiences().

namespace ConvertSdk\DTO;

readonly class BucketedVariation
{
    public function __construct(
        public string $experienceId,
        public string $experienceKey,
        public string $variationId,
        public string $variationKey,
        public array $changes,
    ) {}
}
PropertyTypeDescription
experienceIdstringThe experience ID
experienceKeystringThe experience key
variationIdstringThe variation ID
variationKeystringThe variation key
changesarrayThe variation changes (feature change data)

BucketedFeature

Returned by runFeature() and runFeatures().

namespace ConvertSdk\DTO;

readonly class BucketedFeature
{
    public function __construct(
        public string $featureId,
        public string $featureKey,
        public FeatureStatus $status,
        public array $variables,
    ) {}
}
PropertyTypeDescription
featureIdstringThe feature ID
featureKeystringThe feature key
statusFeatureStatusThe feature status — a backed PHP enum (FeatureStatus::Enabled or FeatureStatus::Disabled)
variablesarrayThe feature variables with their resolved values

ConversionAttributes

Passed to trackConversion().

namespace ConvertSdk\DTO;

readonly class ConversionAttributes
{
    public function __construct(
        public ?array $ruleData = null,
        public ?array $conversionData = null,
        public ?array $conversionSetting = null,
    ) {}
}
PropertyTypeDescription
ruleData?arrayKey-value pairs used for goal rule matching
conversionData?array<GoalData>Transaction data entries (see GoalData below)
conversionSetting?arrayTracking settings: forceMultipleTransactions (bool) — whether to accumulate revenue for the same visitor

GoalData

Individual revenue/goal data entry, used within ConversionAttributes->conversionData.

namespace ConvertSdk\DTO;

readonly class GoalData
{
    public function __construct(
        public GoalDataKey $key,
        public int|float|string $value,
    ) {}
}
PropertyTypeDescription
keyGoalDataKeyA backed PHP enum — one of: Amount, ProductsCount, TransactionId, CustomDimension1..CustomDimension5
valueint|float|stringThe value for this key

Backed Enums

FeatureStatus

namespace ConvertSdk\Enums;

enum FeatureStatus: string
{
    case Enabled = 'enabled';
    case Disabled = 'disabled';
}

RuleError

Returned by trackConversion() when rule evaluation fails.

namespace ConvertSdk\Enums;

enum RuleError: string
{
    case NoDataFound = 'convert.com_no_data_found';
    case NeedMoreData = 'convert.com_need_more_data';
}
  • RuleError::NoDataFound — no matching data for the rule
  • RuleError::NeedMoreData — insufficient data provided to evaluate the rule

BucketingError

namespace ConvertSdk\Enums;

enum BucketingError: string
{
    case VariationNotDecided = 'convert.com_variation_not_decided';
}

GoalDataKey

Used with GoalData for conversion tracking.

namespace ConvertSdk\Enums;

enum GoalDataKey: string
{
    case Amount = 'amount';
    case TransactionId = 'transactionId';
    case ProductsCount = 'productsCount';
    case CustomDimension1 = 'customDimension1';
    case CustomDimension2 = 'customDimension2';
    case CustomDimension3 = 'customDimension3';
    case CustomDimension4 = 'customDimension4';
    case CustomDimension5 = 'customDimension5';
}
KeyBacked ValueType
GoalDataKey::Amount'amount'int|float
GoalDataKey::ProductsCount'productsCount'int
GoalDataKey::TransactionId'transactionId'string
GoalDataKey::CustomDimension1'customDimension1'int|float|string
GoalDataKey::CustomDimension2'customDimension2'int|float|string
GoalDataKey::CustomDimension3'customDimension3'int|float|string
GoalDataKey::CustomDimension4'customDimension4'int|float|string
GoalDataKey::CustomDimension5'customDimension5'int|float|string

SystemEvents

Used with the on() method for event subscriptions.

namespace ConvertSdk\Enums;

enum SystemEvents: string
{
    case Ready = 'ready';
    case ConfigUpdated = 'config.updated';
    case Bucketing = 'bucketing';
    case Conversion = 'conversion';
    case Segments = 'segments';
    case LocationActivated = 'location.activated';
    case LocationDeactivated = 'location.deactivated';
    case Audiences = 'audiences';
    case ApiQueueReleased = 'api.queue.released';
}

LogLevel

Used in the logger configuration.

namespace ConvertSdk\Enums;

enum LogLevel: string
{
    case Trace = 'trace';
    case Debug = 'debug';
    case Info = 'info';
    case Warn = 'warn';
    case Error = 'error';
    case Silent = 'silent';
}

EntityType

Used with getConfigEntity() and getConfigEntityById().

namespace ConvertSdk\Enums;

enum EntityType: string
{
    case Audience = 'audience';
    case Location = 'location';
    case Segment = 'segment';
    case Feature = 'feature';
    case Goal = 'goal';
    case Experience = 'experience';
    case Variation = 'variation';
}

Auto-Generated Types

The ConfigResponseData, ConfigExperience, ConfigFeature, and other configuration types are auto-generated from the Convert API OpenAPI specification. These are provided by the OpenAPI\Client package and ensure the SDK's understanding of data structures matches the Convert servers exactly.