Constructor
# new Context(config, dependencies)
Parameters:
Name | Type | Description |
---|---|---|
config |
Config
|
|
dependencies |
Object
|
|
apiManager |
ApiManagerInterface
|
|
eventManager |
EventManagerInterface
|
|
experienceManager |
ExperienceManagerInterface
|
|
featureManager |
FeatureManagerInterface
|
|
dataManager |
DataManagerInterface
|
|
apiManager |
ApiManagerInterface
|
|
loggerManager |
LogManagerInterface
|
- Implements:
- ContextInterface
Classes
Methods
# getConfigEntity(key, entityType) → {Entity}
get Config Entity
Parameters:
Name | Type | Description |
---|---|---|
key |
string
|
|
entityType |
EntityType
|
Entity
# getConfigEntityById(id, entityType) → {Entity}
get Config Entity by string
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
|
entityType |
EntityType
|
Entity
# getVisitorProperties(attributesopt) → {Record.<string, any>}
Get visitor properties
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
attributes |
Record.<string, any>
|
<optional> |
An object of key-value pairs that are used for audience targeting |
Record.<string, any>
# releaseQueues(reasonopt) → {Promise.<any>}
Send pending API/DataStore queues to server
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
reason |
string
|
<optional> |
Promise.<any>
# runCustomSegments(segmentKeys, attributesopt) → {RuleError}
Match Custom segments
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
segmentKeys |
Array.<string>
|
A list of segment keys | |
attributes |
SegmentsAttributes
|
<optional> |
An object that specifies attributes for the visitor |
ruleData |
Record.<string, any>
|
<optional> |
An object of key-value pairs that are used for segments matching |
RuleError
# runExperience(experienceKey, attributesopt) → {BucketedVariation|RuleError|BucketingError}
Get variation from specific experience
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
experienceKey |
string
|
An experience's key that should be activated | |
attributes |
BucketingAttributes
|
<optional> |
An object that specifies attributes for the visitor |
locationProperties |
Record.<any, any>
|
<optional> |
An object of key-value pairs that are used for location matching |
visitorProperties |
Record.<any, any>
|
<optional> |
An object of key-value pairs that are used for audience targeting |
updateVisitorProperties |
boolean
|
<optional> |
Decide whether to update visitor properties upon bucketing |
environment |
string
|
<optional> |
Overwrite the environment |
BucketedVariation
|
RuleError
|
BucketingError
# runExperiences(attributesopt) → {Array.<(BucketedVariatio|RuleError|BucketingError)>}
Get variations across all experiences
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
attributes |
BucketingAttributes
|
<optional> |
An object that specifies attributes for the visitor |
locationProperties |
string
|
<optional> |
An object of key-value pairs that are used for location matching |
visitorProperties |
Record.<any, any>
|
<optional> |
An object of key-value pairs that are used for audience targeting |
updateVisitorProperties |
boolean
|
<optional> |
Decide whether to update visitor properties upon bucketing |
environment |
string
|
<optional> |
Overwrite the environment |
Array.<(BucketedVariatio|RuleError|BucketingError)>
# runFeature(key, attributesopt) → {BucketedFeature|RuleError|Array.<(BucketedFeature|RuleError)>}
Get feature and its status
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string
|
A feature key | |
attributes |
BucketingAttributes
|
<optional> |
An object that specifies attributes for the visitor |
locationProperties |
string
|
<optional> |
An object of key-value pairs that are used for location matching |
visitorProperties |
Record.<any, any>
|
<optional> |
An object of key-value pairs that are used for audience targeting |
updateVisitorProperties |
boolean
|
<optional> |
Decide whether to update visitor properties upon bucketing |
environment |
string
|
<optional> |
Overwrite the environment |
typeCasting |
boolean
|
<optional> |
Control automatic type conversion to the variable's defined type. Does not do any JSON validation. Defaults to `true` |
experienceKeys |
Array.<string>
|
<optional> |
Use only specific experiences |
BucketedFeature
|
RuleError
|
Array.<(BucketedFeature|RuleError)>
# runFeatures(attributesopt) → {Array.<(BucketedFeature|RuleError)>}
Get features and their statuses
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
attributes |
BucketingAttributes
|
<optional> |
An object that specifies attributes for the visitor |
locationProperties |
string
|
<optional> |
An object of key-value pairs that are used for location matching |
visitorProperties |
Record.<any, any>
|
<optional> |
An object of key-value pairs that are used for audience targeting |
updateVisitorProperties |
boolean
|
<optional> |
Decide whether to update visitor properties upon bucketing |
environment |
string
|
<optional> |
Overwrite the environment |
typeCasting |
boolean
|
<optional> |
Control automatic type conversion to the variable's defined type. Does not do any JSON validation. Defaults to `true` |
Array.<(BucketedFeature|RuleError)>
# setCustomSegments(segmentKeys, attributesopt) → {RuleError}
To be deprecated
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
segmentKeys |
Array
|
||
attributes |
SegmentsAttributes
|
<optional> |
RuleError
# setDefaultSegments(segments) → {void}
Set default segments for reports
Parameters:
Name | Type | Description |
---|---|---|
segments |
VisitorSegments
|
A segment key |
void
# trackConversion(goalKey, attributesopt) → {RuleError}
Trigger Conversion
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
goalKey |
string
|
A goal key | |
attributes |
ConversionAttributes
|
<optional> |
An object that specifies attributes for the visitor |
ruleData |
Record.<string, any>
|
<optional> |
An object of key-value pairs that are used for goal matching |
conversionData |
Array.<GoalData>
|
<optional> |
An array of key-value pairs that are used for transaction data |
conversionSetting |
Record.<ConversionSettingKey, (number|string|boolean)>
|
An object of key-value pairs that are used for tracking settings |
RuleError
# updateVisitorProperties(visitorId, visitorProperties) → {void}
Update visitor properties in memory
Parameters:
Name | Type | Description |
---|---|---|
visitorId |
string
|
|
visitorProperties |
Record.<string, any>
|
void