-
Notifications
You must be signed in to change notification settings - Fork 0
tracking conversions
Conversion tracking lets you record goal completions for visitors bucketed into experiences. The SDK evaluates the goal's configured triggering rules and sends conversion (and optionally transaction) events to the Convert tracking API.
Track a goal conversion by passing its unique key:
$context->trackConversion('goal-key');You can pass additional attributes to control rule matching, attach revenue data, and configure tracking behavior:
use ConvertSdk\DTO\ConversionAttributes;
use ConvertSdk\DTO\GoalData;
use ConvertSdk\Enums\GoalDataKey;
$context->trackConversion('goal-key', new ConversionAttributes(
ruleData: [
'action' => 'buy',
],
conversionData: [
new GoalData(GoalDataKey::Amount, 10.3),
new GoalData(GoalDataKey::ProductsCount, 2),
new GoalData(GoalDataKey::TransactionId, 'transaction-unique-id'),
],
conversionSetting: [
'forceMultipleTransactions' => false,
],
));| Property | Type | Description |
|---|---|---|
ruleData |
object / array | Key-value pairs used for goal rule matching. The conversion only fires if the rules match. |
conversionData |
array | Transaction data entries (see below). When present, the SDK sends both a conversion event and a transaction event. |
conversionSetting |
object / array | Tracking behavior overrides. Supports forceMultipleTransactions (boolean). |
| Key | Type | Description |
|---|---|---|
amount |
number | Order value |
productsCount |
number | Order quantity |
transactionId |
string or number | Unique transaction identifier |
The PHP SDK also supports customDimension1 through customDimension5 for additional custom data.
To report revenue, include conversionData with your conversion. At minimum, pass amount and transactionId:
use ConvertSdk\DTO\ConversionAttributes;
use ConvertSdk\DTO\GoalData;
use ConvertSdk\Enums\GoalDataKey;
$context->trackConversion('purchase-completed', new ConversionAttributes(
conversionData: [
new GoalData(GoalDataKey::Amount, 99.99),
new GoalData(GoalDataKey::ProductsCount, 3),
new GoalData(GoalDataKey::TransactionId, 'txn-abc-123'),
],
));When conversionData is present, the SDK sends two events: a conversion event and a transaction event containing the goal data.
By default, each goal fires once per visitor per experience. Subsequent calls to trackConversion for the same visitor and goal are silently ignored (deduplication).
For recurring transactions such as subscription renewals, override deduplication by setting forceMultipleTransactions to true:
use ConvertSdk\DTO\ConversionAttributes;
use ConvertSdk\DTO\GoalData;
use ConvertSdk\Enums\GoalDataKey;
use ConvertSdk\Enums\ConversionSettingKey;
$context->trackConversion('subscription-renewal', new ConversionAttributes(
conversionData: [
new GoalData(GoalDataKey::Amount, 29.99),
new GoalData(GoalDataKey::TransactionId, 'renewal-456'),
],
conversionSetting: [
ConversionSettingKey::ForceMultipleTransactions->value => true,
],
));| Scenario | Conversion Event | Transaction Event |
|---|---|---|
| First trigger, no goal data | Sent | Not sent |
| First trigger, with goal data | Sent | Sent |
| Repeat trigger, no force | Not sent | Not sent |
| Repeat trigger, force=true, no goal data | Not sent | Not sent |
| Repeat trigger, force=true, with goal data | Not sent | Sent |
Note: When
forceMultipleTransactionsis enabled on a repeat trigger, only the transaction event is sent (revenue is accumulated). The conversion event itself is still deduplicated -- it only fires once per visitor per experience.
Copyrights © 2026 All Rights Reserved by Convert Insights, Inc.
Getting Started
Ruby SDK
- Quickstart
- Installation
- Initialization
- Configuration
- Return Types & Sentinels
- Code Examples
- Fork Safety & Runtime Recipes
- Tracking Control
Core Concepts
- Experiences & Variations
- Feature Flags
- Bucketing Algorithm
- Rule Evaluation
- Segments
- Data Management
- Event System
- API Communication
How-To Guides
- Running Experiences
- Running Features
- Tracking Conversions
- Visitor Context
- Persistent DataStore
- Troubleshooting
Contributing