Cross Site Tracking

This default code will help you pass our click ID from the original page to another to allow for cross site tracking.

peter kurjanowicz avatar
Written by peter kurjanowicz
Updated over a week ago

Overview

When working with Everflow's JavaScript SDK we set a cookie on the domain where the EF.click() script is executed. If that domain is different than the domain where the EF.conversion() code is executed you will need to pass our click ID to the same domain where the EF.conversion() code is executed. You will need a basic understanding of JavaScript to implement this correctly.


Step #1

Verify that your website is using "href" anchor tags by running this code in the console inside the developer tools:

var siteUrl = "INSERT_CROSS_SITE_DOMAIN"; 
var elems = document.body.getElementsByTagName("a");
for (var i = 0; i < elems.length; i++){
if (elems[i].href.includes(siteUrl)) {
console.log(elems[i].href);
}
}

Please replace INSERT_CROSS_SITE_URL with the actual cross site URL. This is the domain that your current site links to. Here is a screenshot of what it should look like:
​

This is what you are looking for:
​

If you just get "Undefined" this means that your page uses a different format or the site URL is incorrect. Please contact support in this case.

Step #2

Please place this code into the <head> of your site:

<script type="text/javascript" 
src="https://INSERT_YOUR_TRACKING_DOMAIN/scripts/sdk/everflow.js"></script>

<script type="text/javascript">
var siteUrl = 'INSERT_CROSS_SITE_DOMAIN'; //example: "everflow.io"
var advertiserId = 'INSERT_ADVERTISER_ID';

window.onload = function() {
var elems = document.body.getElementsByTagName("a");
if (!EF.getAdvertiserTransactionId(advertiserId)) {
EF.click({
offer_id: EF.urlParameter('oid'),
affiliate_id: EF.urlParameter('affid'),
sub1: EF.urlParameter('sub1'),
sub2: EF.urlParameter('sub2'),
sub3: EF.urlParameter('sub3'),
sub4: EF.urlParameter('sub4'),
sub5: EF.urlParameter('sub5'),
uid: EF.urlParameter('uid'),
source_id: EF.urlParameter('source_id'),
transaction_id: EF.urlParameter('_ef_transaction_id'),
}).then(function(transaction_id){
for (var i = 0; i < elems.length; i++){
if (elems[i].href.includes(siteUrl)) {
var url = new URL(elems[i].href);
url.searchParams.set('_ef_transaction_id', transaction_id);
elems[i].href = url.href
}
}
});
} else {
for (var i = 0; i < elems.length; i++){
if (elems[i].href.includes(siteUrl)) {
var url = new URL(elems[i].href);
url.searchParams.set('_ef_transaction_id', EF.getAdvertiserTransactionId(advertiserId));
elems[i].href = url.href
}
}
}
}
</script>

Please replace INSERT_YOUR_TRACKING_DOMAIN with your tracking domain found in Control Center > Configuration > Domains tab (you can use any tracking domain if you have multiple)

Please replace INSERT_ADVERTISER_ID with the advertiser ID found on the offer page here:
​

Please replace INSERT_CROSS_SITE_DOMAIN with the domain where you want to pass our click ID, an example would be "helpdesk.everflow.io"

Step #3

After this is done please also place this code in the <head> of the cross site URL as well. For example, I would place the code in Step 2 on "everflow.io" and then place the code below on "helpdesk.everflow.io":

<script type="text/javascript" 
src="https://INSERT_YOUR_TRACKING_DOMAIN/scripts/sdk/everflow.js"></script>

<script type="text/javascript">
EF.click({
offer_id: EF.urlParameter('oid'),
affiliate_id: EF.urlParameter('affid'),
sub1: EF.urlParameter('sub1'),
sub2: EF.urlParameter('sub2'),
sub3: EF.urlParameter('sub3'),
sub4: EF.urlParameter('sub4'),
sub5: EF.urlParameter('sub5'),
uid: EF.urlParameter('uid'),
source_id: EF.urlParameter('source_id'),
transaction_id: EF.urlParameter('_ef_transaction_id'),
});
</script>

Please replace INSERT_YOUR_TRACKING_DOMAIN with your tracking domain found in Control Center > Configure > Domains tab (you can use any tracking domain if you have multiple).

Step #4

After this is done please makes sure to also place the EF.conversion() code on the conversion page.
​


NEED HELP? OUR CUSTOMER SUCCESS TEAM IS HERE FOR YOU!

We've assembled a superstar team of industry veterans that are available around the clock to make sure that your issues are resolved and questions are answered. You can reach out any time in-platform via Chat or by emailing support@everflow.io.

Did this answer your question?