Click Tracking
The simplest way to start tracking clicks is to generate a click using the following code :
EF.click({
offer_id: 1, // Required. The offer id
affiliate_id: 1, //Required. The affiliate id
});
You may wish to add additional data that will be passed along with the click :
EF.click({
offer_id: 1, // Required. The offer id
affiliate_id: 1, //Required. The affiliate id
uid: 5, // Optional : Offer URL Id
creative_id: 14, // Optional : Offer Creative ID
// Optional. Sub placement values.
sub1: '',
sub2: '',
sub3: '',
sub4: '',
sub5: '',
source_id: '',
coupon_code: '...', // Optional Coupon Code at the click level
disable_fingerprinting: false, // Optional. Browser fingerprinting is used to enhance user tracking. Defaults to false when omitted
});
Extracting data from the URL
When working with direct linking, the affiliate id involved in the click will most likely be dynamic and the value will be passed in the query string of the URL.
The Everflow SDK provides a method to extract any value from the URL. In the following example, the script executes on a landing page where the affiliate id is passed using the affid
url parameter : https://destination-url.com?affid=5
EF.click({
offer_id: 1, // Required. The offer id
affiliate_id: EF.urlParameter('affid'), //Required. The affiliate id
});
The EF.urlParameter
can be used to extract any query string parameter from the URL. For example if the destination URL was instead : https://destination-url.com?oid=3&affid=5&src=facebook&app=mobile
, you could use the following code :
EF.click({
offer_id: EF.urlParameter('oid'), // Required. The offer id
affiliate_id: EF.urlParameter('affid'), //Required. The affiliate id
sub3: EF.urlParameter('src'), // Optional : "facebook" would be passed as the sub3 in this example
sub4: EF.urlParameter('app'), // Optional : "mobile" would be passed as the sub4 in this example
sub5: EF.urlParameter('ref'), // The "ref" query string parameter is missing from the URL. Nothing would be passed as the sub5
});
ITP Workaround And First-Party Cookie Tracking
You can use the Everflow SDK to enhance traditional tracking when you own landing pages. In other words, you can use the Everflow SDK even if you use traditionnal redirect links, which will have the benefit of setting a first-party cookie.
In order to do so, fill the transaction_id
parameter when using EF.click
. Normally, you would configure your destination url to include the transaction_id
, offer_id
and affiliate_id
macros. Given the following destination url: https://destination-url.com?transaction_id=af189e77650e4e908af797b61b03ac0b&oid=1&affid=5
EF.click({
offer_id: EF.urlParameter('oid'),
affiliate_id: EF.urlParameter('affid'),
transaction_id: EF.urlParameter('transaction_id')
});
Advanced Use
Fetching The Transaction ID
Clicks are identified by unique transaction IDs in Everflow. There are scenarios in which it can be useful to make use of that transaction ID immediately after generating a click.
The EF.click
method returns a Promise which, when resolved, will give the transaction ID :
EF.click({
offer_id: EF.urlParameter('oid'),
affiliate_id: EF.urlParameter('affid'),
})
.then((transactionId) => {
// transactionId containts the unique Everflow transaction ID
console.log(transactionId)
});
Extracting The Transaction ID
It’s also possible to extract the transaction ID of the last click that was generated using EF.click
for a given user. This can be useful in scenarios where, for example, the user initially lands on the following URL : https://destination-url.com/page-A?oid=3&affid=5
. The click is generated using
EF.click({
offer_id: EF.urlParameter('oid'),
affiliate_id: EF.urlParameter('affid'),
});
If the user later navigates to https://destination-url.com/page-B
, you can access the transaction ID by executing
var offerId = 3;
var efTid = EF.getTransactionId(offerId);
The EF.getTransactionId
method will return the latest transaction ID found. It will return an empty string if no transaction ID is found.
You can also access the latest transaction id for a specific advertiser ID, regardless of the offer ID.
var advertiserId = 1;
var efTid = EF.getAdvertiserTransactionId(advertiserId)