Conversion Tracking
Tracking conversions using the Everflow SDK
Conversions can also be tracked using the Everflow SDK using the following code :
EF.conversion({
offer_id: 1, // The offer id. Required if aid is not provided
aid: 2, // The advertiser id. Required if offer_id is not provided
transaction_id: '', // Optional. The Everflow unique transaction id
})
While the transaction_id
is optional, providing it is always more reliable if you have access to it. When the value is missing, the SDK tries to locate it using :
- First Party Cookie
- Third Party Cookie (on the tracking domain)
Additional options may be used on the EF.conversion
method :
EF.conversion({
offer_id: 1, // The offer id. Required if aid is not provided
aid: 2, // The advertiser id. Required if offer_id is not provided
transaction_id: '', // Optional. The Everflow unique transaction id
amount: 0, // Optional. Sale Amount -- relevant for RPS offers
event_id: 0, // Optional. The event id
coupon_code: '', // Optional. Coupon code
adv_event_id: 0, // Optional. If you use global advertiser events
order_id: '', // Optional
user_id: '', // Optional. User tracking
verification_token: '', // Required if the advertiser is configured to use verification tokens
email: '', // Optional
// Optional. Adv placement values.
adv1: '',
adv2: '',
adv3: '',
adv4: '',
adv5: '',
})
Custom Parameters
It’s also possible to add free form parameters to the conversion. This is effectively equivalent to adding additional query string parameters when using server postbacks.
EF.conversion({
offer_id: 1, // The offer id. Required if aid is not provided
aid: 2, // The advertiser id. Required if offer_id is not provided
transaction_id: 'af189e77650e4e908af797b61b03ac0b', // Optional. The Everflow unique transaction id
amount: 19.99, // Optional. Sale Amount -- relevant for RPS offers
event_id: 23, // Optional. The event id
//Optional. Free form parameters to be appended to the conversion URL
parameters: {
"param1" : "customValue1",
"param2" : "customValue2"
}
})
Advanced Use
Fetching The Transaction ID / Conversion ID
The EF.conversion
method returns a Promise which, when resolved, will give you an object that contains both the transaction ID and the conversion ID related to the conversion that was just generated.
EF.conversion({
offer_id: 1,
aid: 2,
amount: 9.99,
event_id: 11,
})
.then((conversion) => {
console.log(conversion.conversion_id);
console.log(conversion.transaction_id)
});