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,
) {}
}| Property | Type | Description |
|---|---|---|
experienceId | string | The experience ID |
experienceKey | string | The experience key |
variationId | string | The variation ID |
variationKey | string | The variation key |
changes | array | The 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,
) {}
}| Property | Type | Description |
|---|---|---|
featureId | string | The feature ID |
featureKey | string | The feature key |
status | FeatureStatus | The feature status — a backed PHP enum (FeatureStatus::Enabled or FeatureStatus::Disabled) |
variables | array | The 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,
) {}
}| Property | Type | Description |
|---|---|---|
ruleData | ?array | Key-value pairs used for goal rule matching |
conversionData | ?array<GoalData> | Transaction data entries (see GoalData below) |
conversionSetting | ?array | Tracking 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,
) {}
}| Property | Type | Description |
|---|---|---|
key | GoalDataKey | A backed PHP enum — one of: Amount, ProductsCount, TransactionId, CustomDimension1..CustomDimension5 |
value | int|float|string | The 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 ruleRuleError::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';
}| Key | Backed Value | Type |
|---|---|---|
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.
Updated about 1 month ago