Integration With JavaScript
If your website support javascript then you can refer javascript integration guide to integrate our visit, leads, and conversion method with custom parameter in your source code to trigger.
Visits
This method is used to trigger visit requests from your website to AffiliateFox portal to store it. You can copy and paste below source code to the store to request a visit with details parameters like affiliate reference. On AffiliateFox portal you can see the count of a visit saved by each affiliate.
<script src="https://api.AffiliateFox.com/v4.js" async></script>
<script>
(function(parent,afx,arguments){
parent.AffiliateFoxObject=afx;
if(parent[afx] == null) {
parent[afx]= function() {
if(parent[afx].queue == null) {
parent[afx].queue = [];
}
parent[afx].queue.push(arguments);
}
}
})(window,'afox');
var options = {'integration': "javascript"};
var source = { "account_id" : "<PASTE YOUR ACCOUNT SCRIPT ID HERE>" };
afox("initiate", source, options);
afox("hit", source, options);
</script>
source |
You need to pass account script key here like {
"account_id" : "Your Account Script Key" }
You will get account script key in company settings section. |
options |
This field is use set integration type in visit request. |
callback(optional) |
This field is optional. If you want to use callback on visit response then declare callback like below var callback = function(message, status){
"Enter code which you want execute on callback"
};
And pass extra parameter in hit call like afox("hit", source, options, callback);
|
Lead
This method is used to trigger lead requests from your website to AffiliateFox portal to store it. You can copy and paste below source code to the store to request leads with details parameters like affiliate reference. On AffiliateFox portal you can see the count of leads saved by each affiliate.
<script src="https://api.AffiliateFox.com/v4.js" async></script>
<script>
(function(parent,afx,arguments){
parent.AffiliateFoxObject=afx;
if(parent[afx] == null) {
parent[afx]= function() {
if(parent[afx].queue == null) {
parent[afx].queue = [];
}
parent[afx].queue.push(arguments);
}
}
})(window,'afox');
var account_id = "<PASTE YOUR ACCOUNT SCRIPT ID HERE>";
var options = {'integration': "javascript"};
var source = { "account_id" : "<PASTE YOUR ACCOUNT SCRIPT ID HERE>" };
afox("initiate", source, options);
options = {'unique_lead_id': 'YOUR CLIENT ID', 'integration': "javascript"};
afox("lead", source, options);
</script>
source |
You need to pass company script id here like {
"account_id" : "YOUR ACCOUNT ID" }
You will get account script key in company settings section. |
options |
You need to pass your system unique lead id here. This is
mostly used on your system for various purpose. This is used on
our system for cross referring purpose. You need to pass this
value like {'unique_lead_id': 'YOUR CLIENT ID
', 'integration':'javascript'}
YOUR CLIENT ID |
You need to pass this value like '12345' |
|
callback(Optional) |
Callback field is optional. This field is use when callback needed. e.g. if when signup request done and on success signup request if page is redirect then need to use callback like below
declare callback like
var callback = function(message, status){
"Paste code which is executed on success response"
};
Then pass extra parameter in lead method like afox("lead", source, options, callback);
|
Conversion
Whenever a conversion takes place, you will need to signal our platform that this happened. To do so, you can use our conversion page code. This code is usually placed on your thank you page, right after the order has been completed, or the lead data has been collected. There are several levels of integration possible with this code. By far the easiest is by using the following snippet:.
<script src="https://api.AffiliateFox.com/v4.js" async></script>
<script>
(function(parent,afx,arguments){
parent.AffiliateFoxObject=afx;
if(parent[afx] == null) {
parent[afx]= function() {
if(parent[afx].queue == null) {
parent[afx].queue = [];
}
parent[afx].queue.push(arguments);
}
}
})(window,'afox');
var options = {'integration': "javascript"};
var source = { "account_id" : "<PASTE YOUR ACCOUNT SCRIPT ID HERE>"};
afox("initiate", source, options);
options = {
'unique_conversion_id': 'YOUR UNIQUE CONVERSION ID',
'purchase_value': 'YOUR PURCHASE VALUE',
'unique_lead_id': "YOUR CLIENT ID",
'integration': "javascript"
};
afox("conversion", source, options);
</script>
Source |
You need to pass account script key here i.e account like {
"account_id" : "Your Account Script Key" }
You will get account script key in company settings section. |
callback(Optional) |
Callback field is optional. This field is use when callback needed. e.g. if when conversion request done and on success conversion request if page is redirect then need to use callback like below
declare callback like
var callback = function(message, status){
"Paste code which is executed on success response"
};
Then pass extra parameter in conversion method like afox("conversion", source, options, callback);
|