This function allows sending a conversion event with the provided conversion product object identifier, optionally overriding some specific details, like 'price' or 'renewal frequency'.
The site identifier must be set with cX.setSiteId function before this function can be used.
Input
The sendConversionEvent function has the following definition: function(conversionParams, options).
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
Object |
Yes |
Parameters describing the conversion. |
|
|
Object |
No |
Various options overriding defaults set by the script itself. |
The conversionParams object has the following fields. Any additional information can be found here.
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
String |
Yes |
Conversion product object identifier the conversion is applied to. |
|
|
String |
Yes |
Conversion funnel step. Additionally to pre-defined 'convertProduct', 'terminateProduct' and 'renewProduct' can be any custom one. |
* The format of the product related fields corresponds to the one defined on conversion product object e.g. the productRenewalFrequency field in JSON corresponds to the renewalFrequency field in the API object.
The options object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
List of UserIdentity |
No |
User identities. If omitted, the script assigns one automatically. More information here . |
|
|
Function |
No |
Callback for retrieving the result of the request. |
Each UserIdentity object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
String |
Yes |
Site specific identifier (type cx) or external user identifier type. |
|
|
String |
Yes |
Value of the user identifier. |
Output
Please observe that the function has no return value but the response data can be retrieved asynchronously by providing the callback function in the options argument.
The callback function has the following definition: function(result).
|
Name |
Type |
Description |
|---|---|---|
|
|
Object |
Result of the call to the /cce/push API . |
The result object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
Integer |
Response HTTP status code. |
|
|
Object |
Response object received. In case of success must be an empty one. |
Examples
Synchronous
cX.setSiteId('555');
cX.CCE.sendConversionEvent({
'productId': '777',
'funnelStep': 'convertProduct'
}, {
'identities': [{'type': 'xyz', 'id': 'user123'}],
'callback': function(result){
console.log(result.httpStatus); // 200
console.log(result.response); // {}
}
});
Asynchronous
cX.callQueue.push(['setSiteId','555']);
cX.CCE.callQueue.push(['sendConversionEvent', {
'productId': '777',
'funnelStep': 'convertProduct'
}, {
'identities': [{'type': 'xyz', 'id': 'user123'}],
'callback': function(result){
console.log(result.httpStatus); // 200
console.log(result.response); // {}
}
}]);