This page will guide you to integrate and verify Contlo SDK in your Web application.

Prerequisites

To start the SDK integration, you must copy the public API key. Go to your Contlo Dashboard and follow the steps below:

  1. Go to your profile section at the top right corner and click Settings.
  2. Go to Accounts > Store Settings from the sidebar on the Settings homepage.
  3. On the Store Settings page, go to the API keys tab and go to the Public API Key section.
  1. Copy the Public API key to add it later during the SDK integration.

Installation

You can install Contlo's Web SDK in your website project in 2 ways -

  1. Manual installation
  2. NPM package

Manual installation

For manual installation, you have to get the Unique code snippet to connect your custom URL to Contlo. Open your Contlo Dashboard and follow the steps below:

  1. Open the Profile dropdown from the top right corner and open Settings.
  2. Go to the Organization tab from the sidebar. On the organization profile, click the Show Snippet Code button.
  3. On the Unique Snippet Code screen, copy the given Snippet. Given below is a sample snippet:
<script type='text/javascript' async='' src='https://marketing.contlo.com/js
/contlo_messaging_v3.js?v=3&shop_id=[your_public_key]'></script>
  1. Open your website project. Add this snippet either in the index.html file or on the head of every page of your website.

If you are manually installing the SDK, you must add your website URL manually on the Contlo dashboard. Follow the steps below:

  1. Open your Contlo dashboard, go to your profile section at the top right corner, and click Settings.
  2. Go to Accounts > Organization from the sidebar and navigate to the Contact Information section.
  3. Enter your website URL in the Website URL field.

NPM package

To install Contlo's Web SDK via NPM, open your web project and run the following command in the terminal:

npm i contlo-web-sdk

Initialization

Once the installation is complete, follow the steps below to initialize the Contlo SDK:

  1. Import the Contlo package in the files where you want to use the Contlo methods.
import Contlo from 'contlo-web-sdk;'
  1. Add the Contlo's init() method in the file that represents the landing page of your website and pass the API key (created from the Contlo dashboard) and the website URL as the parameters.
Contlo.init('<Public API Key>', '<Website URL>');

Verify integration

After initializing the SDK, open your website in a browser.

Go to the Audiences section on your Contlo dashboard. You would see a new anonymous user is created.

You have successfully integrated the Contlo Web SDK.

Welcome aboard!