Javascript
Installation
To install the ConnectFramework
JavaScript SDK:
If using in a browser, you can include it via a script tag:
Usage
Initializing the SDK
Before making any API calls, initialize the SDK with your API key.
User Authentication
Logging in with a Unique ID
Logs the user in with a unique ID. If uniqueId
is null
, a unique ID will be created automatically. The callback is executed upon completion.
Logging Out
Logs the user out entirely.
Checking if User is Connected
Returns true
if the user is logged in and running the Connect.ai desktop client.
Paywall Management
Creating a Paywall
Creates and presents a new paywall. The callback receives two parameters:
success
(boolean
):true
if the user completed a purchase,false
otherwise.productId
(string | null
): The product ID if a purchase occurred, otherwisenull
.
Setting Extra JSON Data
(Optional) Configures the user JSON settings used by the paywall.
Checking if User has Purchased
Returns true
if the user has already made a purchase. Avoid presenting a paywall if this returns true
.
Analytics Tracking
Logging an Event
Logs an analytics event with a category and action.
Logging an Event with Additional Data
Logs an analytics event with a category, action, label, and numerical value.
Last updated