-
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.track_conversion("goal-key")You can pass additional attributes to control rule matching, attach revenue data, and configure tracking behavior:
# Python maps the monetary amount to revenue= and any other fields to a
# conversion_data dict of JSON primitives (int/float/str). There is no separate
# ruleData argument and no typed GoalDataKey enum on this surface:
context.track_conversion(
"goal-key",
revenue=10.3,
conversion_data={
"products_count": 2,
"transaction_id": "transaction-unique-id",
},
)| 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, Ruby, and iOS SDKs also support customDimension1 through customDimension5 (custom_dimension_1 … custom_dimension_5 in Ruby) for additional custom data.
To report revenue, include conversionData with your conversion. At minimum, pass amount and transactionId:
result = context.track_conversion(
"purchase-completed",
revenue=99.99,
conversion_data={
"products_count": 3,
"transaction_id": "txn-abc-123",
},
)
# track_conversion always returns a typed ConversionResult — inspect result.status
# (QUEUED / DEDUPLICATED / GOAL_NOT_FOUND) instead of catching exceptions.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:
# Dedup is keyed by (visitor_id, goal_id) by goal identity — a differing revenue
# or conversion_data does NOT defeat it. force_multiple=True overrides dedup:
context.track_conversion(
"subscription-renewal",
revenue=29.99,
conversion_data={"transaction_id": "renewal-456"},
force_multiple=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 © 2025 All Rights Reserved by Convert Insights, Inc.
Getting Started
Python SDK
- Quickstart
- Installation
- Initialization
- Configuration
- Code Examples
- Type Hints
- Diagnostics
- Extending
- Testing
- Async & Frameworks
Migration
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
- Direct Tracking Endpoint
- Server-Side Experimentation
- From Tracking Script to SDK
- QA & Preview
- Mutually Exclusive Experiments
Edge & Integrations
Maintainers