Web SDK
Last updated
Last updated
Integrating Conscent.ai on your Website is a simple and direct process. You start by copying the code below within the script tags - and adding it to the header section of your Route Index file.
Ensure you replace the 'clientId' with your actual Client ID retrieved from the Conscent.ai Dashboard and the {SDK_URL} with the SDK URL of an environment you want to use.
In order to ensure that the Conscent.ai Paywall appears on the targeted pages and the deep insights and analytics are collected optimally you need to implement the following function on all the content/article pages.
We import the initialization script using the unique '_csc' identifier and run the 'init' function by passing a number of parameters
The 'contentId' which should be identical to the Content Id by which the particular content is registered - in the Client CMS. This allows us to identify each piece of unique content for a client.
REQUIRED
REQUIRED
The 'title' should be the Content Title by which the particular content is registered within the Client CMS.
REQUIRED
'wrappingElementId' is the id of an element (e.g. a div with absolute positioning on your website) within which you want the paywall to be embedded. Your element should have a minimum width of 320 pixels and a minimum height of 550 pixels for the conscent.ai paywall to fit properly.
REQUIRED
The 'subscriptionUrl' is the link to the Subscription page of the client's website - in cases when a user would like to subscribe to the client's website for accessing the content offered.
OPTIONAL
'signInUrl' is the link to the login page for already subscribed users on the client's platform - in cases when a user has already registered and paid for the client's subscription and would like to access content using their login credentials. Doing this will add a "Sign in here" text to be displayed below the "Subscribe" button.
OPTIONAL
'fullScreenMode' can be set to 'true' or 'false' (strings) -- if true, the first screen of the paywall will cover the entire webpage. This is useful if you don't want the content page to be visible at all once the user proceeds with the payment.
REQUIRED
You need to implement a 'successCallback' function which will receive a response containing a validationObject shown below - indicating whether the user has purchased the content, or if the user has access to the content already since they have purchased it before, or whether the transaction has failed and the user has not purchased the content.
Content Purchased Successfully
The user has purchased content via Conscent.ai.
accessTimeLeft
The user has purchased the content previously and still has free access to consume the content
consumptionId
To verify each unique transaction by a user on the client's content with Conscent.ai
Please ensure that you call this function on all your content pages so that we can track all the events and provide accurate analytics.
The 'clientId' is retrieved from the of the ConsCent Client Dashboard.