Server-Side Platforms

The Web Tracking API can also be integrated on server-side platforms - perfect if you wish to track pathway activities in an external LMS or any server-based platform.

In this scenario, you will be able to have more fine-grained control with deeper integration options.

Examples of Server-Side Web Activities

  • LMS. You would like to integrate course enrolment into a web activity, and/or you want users to complete a course on an LMS in order to mark the activity as complete on their pathway.

  • Utility Platforms. You have a performance or work utility platform and would like users to reach certain milestones or KPIs before the pathway activity is marked as complete.

  • Profile Setups. You want to automate user profile setups and sign-ins on your platform.

Automating Profile Setups & Routing

With a server-side platform, you may want to automate user registration and sign-on for the web activity. This is possible by using the pull endpoint. As the user reaches the provided URL, you will be able to use the webToken to pull user information. The pull endpoint will provide user object, which contains a userToken and available personal information such as email which can be used to identify or register a user.

The pull endpoint will additionally provide activity object, which contains an ID identifier and activity name. This identifier is provided during a Web Activity setup and is used to allow an external reference to your platform. This is useful to where you would want to redirect users to a specific area on your platform e.g. course, task, or page.

Pull Data

curl -X POST \
  v1/webtracking/pull \
  -H 'Authorization: Basic <Your Base64 Encoded Token>' \
  -d '{
	"webToken" : "<webToken>"
}'

Parameters

Key

Type

REQUIRED

webToken

String (get parameter added to the URL).

Response

{
    "status": "success",
    "data": {
        "activity": {
            "name": "Push the button",
            "ID": "FAWT-FQPT-79TC"
        },
        "pathway" : {
            "name": "Pathway A",
            "ID"  : "EV67-ZCNS-56AD"
        }
        "user": {
            "userToken": "5cc31a662c1ce7d78ac75b2bf4a9a40f",
            "email": "test@example.com",
            "firstname": "Falkor",
            "lastname": "Developer"
        },
        "progress": 0,
        "complete": false,
        "data": "",
        "message": ""
    },
    "hash": "510964a04becda2bae678f3e3727825e",
    "response_time": 0.1087651252746582
}

Key

Type

activity

Object. Name and ID of the activity.

pathway

Object. Name and ID of the pathway.

user

Object. User information and unique userToken.

progress

Float. The stored user's progress as a percentage from 0 to 100.

message

String. A stored message string (max. 48 characters).

data

Object. A stored data result as a JSON string.

User Privacy

Push Data

When it comes to pushing data, you can either use the webToken or a combination of the userToken and the activity activity_ID (identifier). This will be dependant on how you plan to store tokens and interact with the push endpoint. To give some scenarios, you could:

  • Store a Session. As the user accesses the URL from the pathway you can store the webToken as a session and make subsequent calls to the push endpoint using the session stored webToken. This makes the most sense if the activity is likely to update while the user is on your platform.

  • Use the activity_ID with the userToken. You can also make calls to the push endpoint by using the activity_ID in combination with the userToken. As the activity_ID (API Identifier) is something you would provide during the Web Activity setup, you would only need to devise logic to store the userToken to a profile on your platform. This makes the most sense if the activity is likely to update whether the user is or is not on your platform.

Parameters Using The webToken

curl -X POST \
  v1/webtracking/push \
  -H 'Authorization: Basic <Your Base64 Encoded Token>' \
  -d '{
    "webToken": "<webToken>",
    "progress": 80,
    "completed": 0,
    "message": "Custom Message",
    "data": "{\"buttonPushes\":8}"
}'

Key

Type

webToken

String

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.

message

String. A stored result string (max. 48 characters).

data

String. A JSON string of data to store.

Parameters Using the userToken with activity_ID

curl -X POST \
  v1/webtracking/push \
  -H 'Authorization: Basic <Your Base64 Encoded Token>' \
  -d '{
    "pathway": "<Name or ID of Pathway>",
    "userToken": "<User Token>",
    "activity_ID": "<Activity ID>"
    "progress": 80,
    "completed": 0,
    "message": "Custom Message",
    "data": "{\"buttonPushes\":8}"
}'

Key

Type

userToken

String

pathway

String. The name or ID of the related pathway

activity_ID

String. The API Identifier the web activity is setup with.

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.

message

String. A stored result string (max. 48 characters).

data

String. A JSON string of data to store.

Success Response

The response will contain pushed indicating that the data has been updated along with the current progress and complete state.

{
    "status": "success",
    "data": {
        "pushed": true,
        "progress": 80,
        "complete": false
    },
    "hash": "c5fa8b54843a16cbbe33688977f2bd02",
    "response_time": 0.12575912475585938
}

Last updated