Direct JS Integration

Step 1: Copy code & place in website Header

Click on Get Javascript SDK and copy the code and place it in the header of your website.



  1. In the case of a common root directory and multiple website integrations/panels, different sw.js files can be handled by implementing double opt-in and individual sub-domain can have independent sw.js according to panel and site.

  2. Javascript size details:
    When it is residing on our server the size is 150 KB and when it is served via CDN it is 45 KB

The code will look like something like this :

<script  src=’//’></script>
smartech('create', '<Smartech Panel identifier>');
smartech('register', '<Website Identifier>');
smartech('identify', '<Unique user identifier/Primary Key of the smartech panel >');

Step 2: Download & place sw.js file at Website root directory

Download Zip file for the sw.js file. You will get this file from the 'get Javascript Code' popup. Place the downloaded sw.js file at the root directory of your website.

Doing the above task will ensure two things -

  1. You will be able to Show Web Messages on your Website.
  2. You will be able to send Web Push Opt-In Message. (Click here for following the Opt-In Steps)

While in most cases adding the above code and the Service Worker (sw.js) file would suffice and will start capturing the user tokens to send push notifications.

However in some cases, if you have been using Vapid technology or One Signal so far to collect tokens and send push notifications as against the FCM and APNS gateway, you will have to further add the following snippet of code along with Js code so that the migration of tokens can be done successfully.

    if (localStorage.getItem('__stmigrate') === null) {
                localStorage.setItem('__stmigrate', 1);


Anatomy of JS File

  1. At the end of the above JS code, 'Identity' is Empty.
  2. Ensure to pass your 'Primary Key' in Identify in case of logged in user.
  3. Leaving the field blank will capture user details anonymously.
  4. When you access the JS file as being shown above, the panel identifier and website identifier of your panel will already be pre-populated.

Once done, you will immediately be able to see tokens coming onto your Smartech Platform.

Updated about a month ago

Direct JS Integration

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.