Javascript Integration Events

Here is the guide to implement the JS

Set up your own backend

In order to make this work, you need to have an endpoint at your side which purpose is to validate the sid. That is the same sid as you put into the sid variable when initializing the intergration. This only applies if your brand is NOT using IGC igaming platform.

Read more here about that auth endpoint / sid validation

CRM Live Events

Integrate the CRM lifecycle events by consuming the following events once they happen. Make sure you have authenticated / initialized the integration. Read about that here

Making sure integration script is fully loaded.

Before you can call any of below events, you need to make sure the integration script is loaded by doing the following:

window.addEventListener("fasttrack-crm-authed", function(event) {
  // Execute functions inside this callback function!
  window.FasttrackCrm.loggedIn()
    .then(response => console.log(response))
    .catch(error => console.log(error));
});

Send Login Event

FasttrackCrm.loggedIn()
  .then(response => console.log(response))
  .catch(error => console.log(error));

Send Registration Event

window.FasttrackCrm.registered(
  "https://www.example.com", // URL Referer
  "note" // Note
)
  .then(response => {})
  .catch(err => {});

Send User Agent Event

FasttrackCrm.updateUserAgent()
  .then(response => console.log(response))
  .catch(error => console.log(error));

Send Bonus Event

window.FasttrackCrm.bonusConsumed(
  10.3, // Amount
  "CHRISTMAS2018", // Bonus code
  "9821", // Bonus id
  1.5, // Bonus turned real
  "SEK", // Currency
  1.1, // Exchange rate
  2.3, // Locked amount
  "Lotto", // Product
  500, // Required wagering amount
  "AutoCompleted", // Status
  "WelcomeBonus", // Type
  "USER_BONUS_ID" // User bonus ID
)
  .then(response => console.log(response))
  .catch(error => console.log(error));

Send Payment/Withdrawal Event Event

window.FasttrackCrm.paymentMade(
  155.5, // Amount
  "BONUS_CODE", // Bonus code
  "SEK", // Currency
  5, // Deposit count
  1.0, // Exchange rate
  5.0, // Fee amount
  "note", // Note
  "0", // Payment id
  "Approved", // Status
  "Capture", // Type
  "11", // Vendor ID
  5 // Withdraw count
)
  .then(response => console.log(response))
  .catch(error => console.log(error));

Pending bonuses

With pending bonuses you will be able to grab pending bonuses and also consume those bonuses. Our script will register a global variable FasttrackCrm.

There are three different types of bonuses:

  • Type = 1 - Pending Bonus - This type can be consumed at any time by calling the Consume endpoint.
  • Type = 2 - Pending Deposit Bonus - In this type, the bonus code needs to be passed to the cashier and it then gets consumed automatically through the corresponding queue message if deposit was successful.
  • Type = 3 - Locked Bonus - In this type, the bonus code needs to be passed to the cashier, and if deposit is successful and criteria met then it is marked as unlocked. At this point, the Consume endpoint needs to be called to apply the bonus.

GetPendingBonuses

To get pending bonuses you will use the following code

FasttrackCrm.getPendingBonuses()
  .then(response => console.log(response))
  .catch(error => console.log(errror));

So our call will return a Promiseand then you can do what you want in then & catch to implement error handling

An Example response looks like this:

[
  {
    "Id": 1,
    "Reference": "3-3-ABC124",
    "MobileGameId": 3,
    "DesktopGameId": 4,
    "MobileGameUrl": "https://fasttrack-solutions.com/game/1234",
    "DesktopGameUrl": "https://fasttrack-solutions.com/game/1234",
    "ImageUrl": "https://www.fasttrack-solutions.com/",
    "DateCreated": "2018-04-26 09:20:14",
    "Description": "10 Free spins on Aloha",
    "Type": 1
  },
  {
    "Id": 2,
    "Reference": "3-3-ABC124",
    "MobileGameId": 3,
    "DesktopGameId": 4,
    "MobileGameUrl": "https://fasttrack-solutions.com/game/1234",
    "DesktopGameUrl": "https://fasttrack-solutions.com/game/1234",
    "ImageUrl": "https://www.fasttrack-solutions.com/",
    "DateCreated": "2018-04-26 09:20:54",
    "Description": "10 Free spins on Aloha",
    "Type": 2,
    "BonusCode": "STEPHENTESTBONUS"
  },
  {
    "Id": 3,
    "Reference": "3-3-ABC124",
    "MobileGameId": 3,
    "DesktopGameId": 4,
    "MobileGameUrl": "https://fasttrack-solutions.com/game/1234",
    "DesktopGameUrl": "https://fasttrack-solutions.com/game/1234",
    "ImageUrl": "https://www.fasttrack-solutions.com/",
    "DateCreated": "2018-04-26 09:23:55",
    "Description": "10 Free spins on Aloha",
    "Type": 3,
    "BonusCode": "STEPHENTESTBONUS2",
    "IsLocked": 1,
    "UnlockAmount": 10
  }
]

GetHistoricalPendingBonsuses

To get consumed bonuses you will use the following code

FasttrackCrm.getHistoricalPendingBonsuses()
  .then(response => console.log(response))
  .catch(error => console.log(errror));

So our call will return a Promiseand then you can do what you want in then & catch to implement error handling

An Example response looks like this:

[
  {
    "Id": 1,
    "Reference": "3-3-ABC124",
    "ImageUrl": "https://www.fasttrack-solutions.com/",
    "DateCreated": "2020-05-18 07:35:50",
    "ExpiryDate": "2020-05-31 08:50:59",
    "Description": "10 Free spins on Aloha",
    "Type": 1,
    "ValidForNextDepositOnly": 0,
    "UnlockAmount": 0,
    "IsLocked": 0,
    "IsConsumed": 1,
    "DateConsumed": "2020-05-19 07:35:58",
    "TermsAndConditions": "Examplestring",
  },
]

Type = 1 = Standard Bonus (no bonus code supplied)

Type = 2 = Deposit Bonus (code for deposit supplied)

Tyoe = 3 = Unlockable Bonus (code for bonus supplied)

ConsumePendingBonus

This method should be run only for:

  • Type = 1 Standard Bonuses - so that the bonus code is applied to the user and marked as claimed

  • Type = 3 Unlockable Bonus - so that the bonus code is applied to the user and marked as claimed (Needs to have property IsLocked = 0, otherwise error returned)

To consume a pending bonus you should pass the Id from the selected bonus.

FasttrackCrm.consumePendingReward(2)
  .then(response => console.log(response))
  .catch(error => console.log(errror));

So our call will return a Promiseand then you can do what you want in then & catch to implement error handling

An Example response looks like this:

{
  "Id": 3,
  "Reference": "3-3-ABC124",
  "MobileGameId": 3,
  "DesktopGameId": 4,
  "MobileGameSlug": "abc-1243",
  "DesktopGameSlug": "abc-1234",
  "ImageUrl": "https://www.fasttrack-solutions.com/",
  "DateCreated": "2018-04-26 09:23:55",
  "IsConsumed": true,
  "DateConsumed": "2018-04-26 11:25:45",
  "Description": "10 Free spins on Aloha",
  "Type": 1
}