User
|
v
Qubit SDK ReactNative
|
v
Javascript ReactNative Bridge API
| |
v v
Android Bridge API iOS Bridge API
| |
v v
Qubit SDK Android Qubit SDK iOS
List of functions of Javascript module, which have to be implemented in native modules for both platforms: Android and iOS.
- init
- sendEvent
- enableTracker
- getTrackingId
- getDeviceId
- getLookupData
- getExperiences
- experienceShown
- getPlacement
- placementImpression
- placementClickthrough
Initialization of SDK. It should be called as early as possible after application start, only once and before any other interaction with the API.
- trackingId
- Type: String
- Constraints: Not null, not empty
- Description: Tracking id (identifier of application/company etc.)
- logLevel
- Type: String
- Constraints: Not null. One of values: SILENT, ERROR, WARN, INFO, DEBUG, VERBOSE. Any other value causes setting default value, which is WARN.
- Level of logs produced by native SDK.
None
QubitSDK.init("miquido", "DEBUG");
Sends event to the server.
- eventType
- Type: String
- Constraints: Not null
- Description: Type of event. eg. ecView
- eventBody
- Type: Javascript map of any structure
- Type: Not null
- Description: Event body
None
- Exception is thrown, when SDK is not initialized.
QubitSDK.sendEvent("ecView", { "type": "button", "value": "click" });
Enables or disables receiving events.
- enable
- Type: Boolean
- Constraints: Not null
- Description: true for enabling, false for disabling
None
- Exception is thrown, when SDK is not initialized.
QubitSDK.enableTracker(false);
Returns trackingId. Debug purposes.
None
Promise with String trackingId.
- Exception is thrown, when SDK is not initialized.
async function asyncFunction() {
var deviceId = await QubitSDK.getTrackingId();
...
}
Returns device id established by the SDK. Debug purposes.
None
Promise with String deviceId.
- Exception is thrown, when SDK is not initialized.
async function asyncFunction() {
var deviceId = await QubitSDK.getDeviceId();
...
}
Returns current Lookup Data. Debug purposes. Although it returns Promise, it returns value only if SDK have these information at the moment of the function call.
None
Promise with Javascript map:
{ viewNumber: 10,
sessionNumber: 4,
lastViewTs: 1863218003,
ipLocation:
{ regionCode: '36004',
region: 'unknown',
longitude: 19.9612,
latitude: 50.0495,
countryCode: 'PL',
country: 'poland',
cityCode: '1803',
city: 'krakow',
areaCode: 'unknown',
area: 'unknown' },
ipAddress: '93.180.179.112',
firstViewTs: 1696635454
}
- Exception is thrown, when SDK is not initialized.
- Exception is thrown, when SDK hasn't fetched Lookup data from server yet.
async function asyncFunction() {
var lookupData = await QubitSDK.getLookupData();
...
}
getExperiences(experienceIds, isVariationSet, variation, isPreviewSet, preview, isIgnoreSegmentsSet, ignoreSegments)
Returns list of Experiences.
- experienceIds
- Type: Array of Integers
- Constraints: Not null.
- Description: List of experiences ids. When array is empty, returns all experiences.
- isVariationSet
- Type: Boolean
- Constraints: Not null.
- Description: Is
variationparameter meaningful?
- variation
- Type: Integer
- Constraints: Not null.
- Description: Meaningful only when
isVariationSetis true?
- isPreviewSet
- Type: Boolean
- Constraints: Not null.
- Description: Is
previewparameter meaningful?
- preview
- Type: Boolean
- Constraints: Not null.
- Description: Meaningful only when
isPreviewSetis true?
- isIgnoreSegmentsSet
- Type: Boolean
- Constraints: Not null.
- Description: Is
ignoreSegmentsparameter meaningful?
- ignoreSegments
- Type: Boolean
- Constraints: Not null.
- Description: Meaningful only when
isIgnoreSegmentsSetis true?
Promise with an array of Experiences objects. Example:
[
{ variation: 852190,
payload: {},
isControl: false,
id: 143640,
callback: 'https://sse.qubit.com/v1/callback?data=igKAeyJFeHBlcmllbmNlSWQiOjE0MzY0MCwiSXRlcmF0aW9uARUsMzc2MDY3LCJWYXJpFRUUODUyNzc0HRUUTWFzdGVyATAQODUyMTkBRXBzQ29udHJvbCI6ZmFsc2UsIlRyYWZmaWNBbGxvYwVKTCI6MC40NzUsIlByb2JhYmlsaXR5ARRQODI1NjI2MTk0NTgyNDQ5MSwiUGlkVhkAGFRlbXBsYXQFvwxudWxsBWZMY2tpbmdJZCI6Im1pcXVpZG8iLCIBjQhleHQFFkQ4MmFjYzNiY2FiYmNhYzM2In0='
},
{ variation: 855620,
payload: { show_share: false,
show_sale_banner: false,
sale_banner: 'https://dd6zx4ibq538k.cloudfront.net/static/images/5010/626263d0b3d3230f4062da1e0d1395ad_1300_554.jpeg',
free_shipping: 'Shipping is free for you!' },
isControl: false,
id: 144119,
callback: 'https://sse.qubit.com/v1/callback?data=jAKAeyJFeHBlcmllbmNlSWQiOjE0NDExOSwiSXRlcmF0aW9uARUsNDUyOTEwLCJWYXJpFRUYMTAxMDcyMh0WFE1hc3RlcgExmDg1NTYyMCwiSXNDb250cm9sIjpmYWxzZSwiVHJhZmZpY0FsbG9jYQFgSCI6MC4yNSwiUHJvYmFiaWxpdHkBE2A0ODAwMTM4OTg0MjEwNjM3MywiUGlkIjowThoAGFRlbXBsYXQFwQxudWxsBWdMY2tpbmdJZCI6Im1pcXVpZG8iLCIBjghleHQFFkQ4MmFjYzNiY2FiYmNhYzM2In0='
},
{ variation: 972984,
payload: {},
isControl: true,
id: 160862,
callback: 'https://sse.qubit.com/v1/callback?data=iQKAeyJFeHBlcmllbmNlSWQiOjE2MDg2MiwiSXRlcmF0aW9uARUsNDM0NjIzLCJWYXJpFRUUOTcyOTg0HRUUTWFzdGVyATARG3BJc0NvbnRyb2wiOnRydWUsIlRyYWZmaWNBbGxvYwVJRCI6MC41LCJQcm9iYWJpbGl0eQESVDAzNjQzMTAyMTQ3MTU5ODkyLCJQaWRaGgAYVGVtcGxhdAW-DG51bGwFZhBja2luZwGLKCJtaXF1aWRvIiwiAYwIZXh0BRZEODJhY2MzYmNhYmJjYWMzNiJ9'
}
]
- Exception is thrown, when SDK is not initialized.
async function asyncFunction() {
var experiences = await QubitSDK.getExperiences([], false, 0, false, false, false, false);
...
}
Sends to server information, that experience was shown
- callback
- Type: String
- Constraints: Not null.
- Description: Value of callback property in the result of getExperiences function.
None
- Exception is thrown, when SDK is not initialized.
QubitSDK.experienceShown("https://sse.qubit.com/v1/callback?data=igK....n0=");
Returns Placement for given parameters.
- placementId
- Type: String
- Constraints: Not null
- Description: Unique ID of the placement.
- mode
- Type: String
- Constraints: Can be one of LIVE/SAMPLE/PREVIEW.
- Description: The mode to fetch placements content with. Defaults to LIVE.
- attributes
- Type: String
- Constraints: Should be string description of JSON or null
- Description: JSON string containing custom attributes to be used to query for the placement. "visitor" attribute will be ignored as it is set by SDK.
- campaignId
- Type: String
- Constraints: Nullable
- Description: Campaign identifier
- experienceId
- Type: String
- Constraints: Nullable
- Description: Experience identifier
Promise with a map describing Placement object:
{
"content": { ... }
"impressionUrl": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
"clickthroughUrl": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
}
The structure of response content depends on the type of placement that is being called.
- Exception is thrown, when SDK is not initialized.
async () => {
const placement = await QubitSDK.getPlacement(
"placement_id",
"LIVE",
"{ \"color\": \"blue\"}",
"campaign_id",
"experience_id"
);
...
}
Sends request to URL described by placement impression callback.
- callbackUrl
- Type: String
- Constraints: Not null
- Description: Impression callback URL.
None
async () => {
const placement = await QubitSDK.placementImpression(
"https://some.url.com"
);
...
}
Sends request to URL described by placement clickthrough callback.
- callbackUrl
- Type: String
- Constraints: Not null
- Description: Clickthrough callback URL.
None
async () => {
const placement = await QubitSDK.placementClickthrough(
"https://some.url.com"
);
...
}