Including fpr.js
On your FirstPromoter dashboard, under the Settings> Integrations> Integrate your website section, based on the selections you make, you are provided with some scripts which are to be added to your website.It is ideal that the script is added globally on the HEAD section of every marketing or public page of your website.
Functions
fpr(“init”,options, callback?)
This method initializes FirstPromoter with the provided options. Most of these options are loaded automatically when the script loads, but they can be overwritten by passing different ones to the method. The most used one is “ref_id” which forces the script to track a specific promoter.Parameters
fpr(“click”,payload?, callback?)
This method is responsible for click tracking.Parameters
Example
fpr(“onReady”,callback)
This method checks if the tracking script is initialized and fully loaded on the page.Parameters
Example
click
fpr(“referral”,payload, callback?)
This method is used primarily to send the referral details to FirstPromoter. It takes as its payload the email of the referral/leadParameters
Example
fpr(“details”,callback)
This method is used in getting the details of the promotion and the promoter. To avoid making multiple requests, it is important to note that the details are stored in a cookie called “fprom_details” and is available for a day.Parameters
Response Format
Example
click
fpr(“crossDomain”,domains)
This method is used when attempting to track across multiple domains. It mainly appends the tracking details to all links to the domain provided. Note: this works with only direct links and should be added preferably to the footer section or called when the whole page is loadedExample
fpr(“urlTracking”)
This method is used for Direct URL tracking, thus, if you have landing pages for your affiliates/promoters, you can use the method on those pages if you don’t want the affiliates/promoters “Referral ID” to be part of their referral links. For this method to work, you will have to first add FirstPromoter’s main tracking scripts to the landing page(s) and also enable “Direct URL tracking” on FirstPromoter. To do so, please check out this article: How to enable direct URL tracking in FirstPromoterPlease note that the method should not be used on your homepage, but instead should only be used on all landing pages of your affiliates/promoters.