Serverless
The Web Tracking API allows for tracking of a pathway activity outside of your app. This option is perfect if your web activity is server-less, or if it is a single-purpose interactive experience. Examples of these could be web games, static websites, or stand-alone learning packages.
In a serverless scenario, the platform acts as the server backbone which allows you to push and pull data for a user on a web activity without the need for server-side technologies (e.g database or server-side languages).
Examples of Serverless Web Activities
Web Game. You have built a web game that you would like to add as a pathway activity. You want users to complete the game / earn a certain score in order for the pathway activity to be considered complete/fulfilled.
Single Website Page OR Web App. You have developed an interactive experience and want users to complete certain actions
in order for the pathway activity to be considered complete/fulfilled.
E-Learning/Online Module. You have developed an e-learning module that is not hosted in a Learning Management System (LMS) and want users to complete the module in order for the pathway activity to be considered complete/fulfilled.
JavaScript Web Tracking
JavaScript SDK
The JavaScript SDK is JavaScript implementation of the existing endpoints for the web tracking API. For more complex integrations we recommend reviewing the curl push / pull endpoints provided in server-side platforms. These endpoints are used in the JavaScript SDK.
Platform
Hosted URL
Falkor
https://api.falkor.io/js-sdk/web-tracking.min.js
ByteKast UK
https://api.uk.bytekast.io/js-sdk/web-tracking.min.js
ByteKast SA
https://api.bytekast.io/js-sdk/web-tracking.min.js
Full Source
https://api.falkor.io/js-sdk/web-tracking/web.tracking.class.js
Initialize the SDK
Before making use of the pull and push method you will need to initialize the Javascript SDK with your Pathway publicKey. The initialization automatically consumes & handles the webToken query parameter provided in the URL; this means you do not need to do anything with the generated webToken.
The publicKey is provided when you add a Web Activity on Pathways
autoComplete is only useful if you are simply wanting to complete the activity as the user visits the page.
The webToken will automatically looked for in the URL. If you are testing and using one token you can also manually provide this parameter in the initWebTracking method. See how Web Activity links work.
Pull Data
To pull data for the activity you need to use the pull method. This method will return a Promise and should be done in an asynchronous call. The pull method will contain previously pushed progression and data for the user on a specific activity.
The pull method makes a CURL call as shown below
Key
Type
progress
Float. The stored user's progress as a percentage of 0 to 100.
complete
Int. The stored user's completion state. 1 = true, 0 = false.
user
Object. Contains information about the user, including a userToken.
message
String. A stored message string (max 48 characters).
data
Object. A stored data result as a JSON string.
Push Data
To push data to Falkor for the activity you need to use the "push" method. This method will return a Promise and can be used asynchronously. When you push data, it stores the information parsed.
The result parameter allows for storing a short message. This message is displayed on the user's Falkor app and creates an opportunity to display a summary of completion or progression to the user.
The push method makes a CURL call as shown below
Key
Type
progress
Float. Store the user's progress as a percentage of 0 to 100.
complete
Int. Store the completion state 1 = true, 0 = false.
message
Store a string (max. 48 characters).
data
Store a valid json string (max. 65,535 characters).
Full Example: "Button Game"
Here is a simple example of using the Javascript Web Tracking API. Along a pathway, the users are presented with a Web Activity that requires them to push a button 10 times in order to complete/fulfil the activity.
Last updated