We'll show you how to send QProtocol events from non-browser, offline, environments such as a call center.
We have set up a service for ingesting QProtocol events from non-browser, offline, environments in a way that is compatible with the features available in our platform, including A/B testing and reporting.
Called via a POST request:
https://offline-conversions.qubit.com/events/:trackingId
Before using the endpoint, you will require the following unique values:
Name | Description |
---|---|
| Qubit tracking Id for the property the request is made from. This will be provided by your CSM |
with:
Content-Type: application/json body:
{
'events': [{
'context': {
'id': '6o2diu81w9o-0irxltk5b-u9t1cv4',
},
'meta': {
'type': 'ecBasketTransactionSummary',
'ts': 1479377213928,
'url': 'http://example.com/page',
'source': 'company-x@1.0.0'
},
'basket': {
'total': {
'value': 9.99,
'currency': 'USD'
}
},
'transaction': {
'id': 'unique-id'
}
}]
}
where:
events
- any number of QProtocol events in a Jolt style JSON wrapper.The common requirement for all events is to have:
context.id
- the Qubit visitor cookie id, see below for how to read this on the client sidemeta.type
- type of event, needs to conform to vertical and schema requirements, e.g. possible values are ecView
, ecBasketTransactionSummary
, trPackageTransactionSummary
, someco.trPackageTransactionSummary
meta.ts
- the timestamp the event was generatedmeta.url
- optionally, the url on which the event was generated (might not be applicable)meta.source
- a way to flag the event producer, e.g. 'my-co@1.0.0'If you're sending basketTransactionSummary
events, here are some special requirements:
transction.id
- unique identifier for the transaction is required, can be randomly generated by the event producer if not available otherwisebasket.total
- the total value of the transaction, both value and currency fields are requiredRefer to the following table for details of the currently supported verticals, their appropriate transaction events, and transaction amount fields:
Vertical | Transaction event | Transaction amount field |
---|---|---|
eCommerce | ecBasketTransactionSummary | basket.total |
eGaming | egBetslipTransactionSummary | betslip.total |
publisher | pbBasketTransactionSummary | basket.total |
logistics | loBasketTransactionSummary | basket.total |
travel | trPackageTransactionSummary | package.total |
finance | fiBasketTransactionSummary | basket.total |
To get the Qubit Visitor Id on the client side, you can use the following inline snippet of JavaScript:
function getQubitVisitorId (cb) {
poll()
function poll () {
if (window.__qubit && window.__qubit.jolt) {
__qubit.jolt.getVisitorState().then(function (visitor) {
cb(visitor.visitorId)
})
} else {
setTimeout(poll, 500)
}
}
}
Alternatively, you can also read it from the __qubitTracker
cookie.
A result object for each event sent/ingested:
{
results: [{
'eventId': 'g2w06o5z9nc-0ivwki51j-km2859c',
'eventType': 'ecBasketTransactionSummary',
'status': 'success',
'warnings': [
'Missing meta.source'
]
}, {
'status': 'failed',
'error': 'Missing context.id'
}]
}
INFO: Successfully ingested events will have status success
. Events that were not ingested will have status error
.
A status message in the event of an unexpected error. Simply reflects some relevant HTTP code in this case, often from upstream systems:
{
'status': 502,
'message': 'Bad Gateway'
}
Required fields are:
{
'events': [{
'context': {
'id': 'hb1ntvmfpug-0iqmaqq7e-glmdos0'
},
'meta': {
'type': 'ecBasketTransactionSummary',
'source': 'yourco@1.0.0',
'ts': 1479471022498
},
'basket': {
'total': {
'value': 80.5,
'currency': 'GBP'
}
},
'transaction': {
'id': 'uniqueId-1'
}
}]
}
{
'events': [{
'context': {
'id': 'hb1ntvmfpug-0iqmaqq7e-glmdos0'
},
'meta': {
'type': 'egBetslipTransactionSummary',
'source': 'yourco@1.0.0',
'ts': 1479471022498
},
'betslip': {
'total: {
'value': 80.5,
'currency': 'GBP'
}
},
'transaction': {
'id': 'uniqueId-1'
}
}]
}
{
'events': [{
'context': {
'id': 'hb1ntvmfpug-0iqmaqq7e-glmdos0'
},
'meta': {
'type': 'trPackageTransactionSummary',
'source': 'yourco@1.0.0',
'ts': 1479471022498
},
'package': {
'total': {
'value': 80.5,
'currency': 'GBP'
}
},
'transaction': {
'id': 'uniqueId-1'
}
}]
}