We’ve migrated our documentation to a new site, which means some URLs have changed.
Audience

sendConversionEvent

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

conversionParams

Object

Yes

Parameters describing the conversion.

options

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

productId

String

Yes

Conversion product object

identifier the conversion is applied to.

funnelStep

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

identities

List of UserIdentity

No

User identities. If omitted, the script assigns one automatically. More information

here

.

callback

Function

No

Callback for retrieving the result of the request.

Each UserIdentity object has the following fields:

Name

Type

Required

Description

type

String

Yes

Site specific identifier (type cx) or

external user identifier

type.

id

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

result

Object

Result of the call to the

/cce/push API

.

The result object has the following fields:

Name

Type

Description

httpStatus

Integer

Response HTTP status code.

response

Object

Response object received. In case of success must be an empty one.

Examples

Synchronous

JavaScript
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

JavaScript
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); // {}
 }
}]);

Last updated: