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.
Key | Type | Description |
---|---|---|
aid | string | The app ID provided by TrackReward |
state | string | This is the initializer of the state of script |
page_url | url | Page url of the visitor vist |
refferrer_url | url | Where came from visitor |
affiliate_code | string | Affiliate unique code for identify manually |
domain | string | Currenct Domain |
track_id | string | Tracking Id, Store in Cookie |
Coupon | string | Code for affiliate track |
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.
Key | Type | Description |
---|---|---|
string | Lead's authentic email address | |
uid | string | user id of the lead |
plan | string | plan of the product |
affiliate_code | string | Affiliate unique code for identify manually |
track_id | string | plan of the product |
Coupon | string | Code for affiliate track |
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.
Key | Type | Description |
---|---|---|
string | Lead's authentic email address | |
uid | string | user id of the lead |
plan | string | plan of the product |
track_id | string | plan of the product |
affiliate_code | string | Affiliate unique code for identify manually |
amount | number | Amount of the sale |
event | string | Event of the sale |
Coupon | string | Code for affiliate track |
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.
Key | Type | Description |
---|---|---|
string | Lead's authentic email address | |
uid | string | user id of the lead |
amount | number | Amount of the sale |
event | string | Event of the sale |
quantity | string | Quantity of the sale |
Coupon | string | Code for affiliate track |
affiliate_code | string | Affiliate unique code for identify manually |
function trackCharge() { Mastutrack.charge({ email: '12@example.com', uid: '12qwee', amount: 600, event: '_charge9897', quantity: 1, }); }