TrackReward Logo
TrackReward's Script (proscript.js)

This document is a guide to all the functions available in TrackReward's web browser JavaScript library, proscript.js.

With proscript.js included

To integrate TrackReward with your website, go to Settings > Integrations > Integrate your website section on your TrackReward dashboard. Based on your choices, you will be given some code snippets to add to your website.

<script src="https://trackreward.com/assets/js/proscript.js"></script> <script> Mastutrack._init({ aid: '<APP ID>', state: 'visit', }); </script>

For JavaScript frameworks, you can easily include the script in the public index.html file, ensuring it's available when the framework loads. For WordPress websites, you can insert the scripts in the header.php file, just before the closing </head> tag. For optimal performance, it's best to include the scripts on every page where tracking is needed. Additionally, since the scripts load asynchronously, they won't impact the website's loading speed.

Uses the Script

Mastutrack._init(options);

This method initializes TrackReward with the provided options. Although most of these options are automatically loaded when the script runs, you can override them by passing new ones to the method. The most commonly used option is "track_id," which forces the script to track a specific affiliate.

Parameters
options
object
required
Available Params
Key Type Description
aid string The app ID provided by TrackReward
statestringThis is the initializer of the state of script
page_urlurlPage url of the visitor vist
refferrer_urlurlWhere came from visitor
affiliate_codestringAffiliate unique code for identify manually
domainstringCurrenct Domain
track_idstringTracking Id, Store in Cookie
CouponstringCode for affiliate track
Example
Mastutrack._init({ aid: '<APP ID>', state: 'visit', });

Mastutrack.lead(options);

The main purpose of this technique is to send the lead information to TrackReward. It uses the lead's or referral's email as its payload.

Parameters
options
object
required
Available Params
Key Type Description
emailstringLead's authentic email address
uidstringuser id of the lead
planstringplan of the product
affiliate_codestringAffiliate unique code for identify manually
track_idstringplan of the product
CouponstringCode for affiliate track
Example
function trackLead() { Mastutrack.lead({ email: '12@example.com', uid: '12qwee', }); }

Mastutrack.sale(options);

This method is used to send the sale information to TrackReward. It uses the sale's or referral's email as its payload.

Parameters
options
object
required
Available Params
Key Type Description
emailstringLead's authentic email address
uidstringuser id of the lead
planstringplan of the product
track_idstringplan of the product
affiliate_codestringAffiliate unique code for identify manually
amountnumberAmount of the sale
eventstringEvent of the sale
CouponstringCode for affiliate track
Example
function trackSale() { Mastutrack.sale({ email: '12@example.com', uid: '12qwee', amount: 600, event: '_sale9897', plan: 'starter', }); }

Mastutrack.charge(options);

This method is used to send the charge information to TrackReward. It uses the charge's or referral's email as its payload.

Parameters
options
object
required
Available Params
Key Type Description
emailstringLead's authentic email address
uidstringuser id of the lead
amountnumberAmount of the sale
eventstringEvent of the sale
quantitystringQuantity of the sale
CouponstringCode for affiliate track
affiliate_codestringAffiliate unique code for identify manually
Example
function trackCharge() { Mastutrack.charge({ email: '12@example.com', uid: '12qwee', amount: 600, event: '_charge9897', quantity: 1, }); }