Web SDK Setup

1. Requirements

Sign up to FlareLane and create a project.


2. Start Setup

Click Channel > Web Push to start setup.


3. Input Website Details

Description

Website Name

Website name will be auto-filled when message title is left blank

Website URL

URL must be started with "https://"


4. Upload sw.js

Download sw.js file and upload it to the root path of your website. (ex. If the file sw.js is located in the 'example.com' domain, it should be accessible at example.com/sw.js)

importScripts("https://cdn.flarelane.com/ServiceWorker.js");

If you upload it correctly, you should be able to access it externally like this:

https://gp.flarelane.com/sw.js


5. SDK Setup

You can check your project ID at FlareLane console's Project

Add the following script right before the </body> tag of your website.

<script src="https://cdn.flarelane.com/WebSDK.js" charset="UTF-8"></script>
<script>FlareLane.initialize({ projectId: "PROJECT_ID" });</script>

6. Test

If everything has been set up correctly, a prompt asking for permission to subscribe will appear when the website is refreshed.

Then, you can proceed with the detailed setting such as the setting up an icon at FlareLane console's Channel > Web Push.


7. Identify your user

FlareLane's device is 'anonymous' and you can match the device with your user based on the unique user ID that identifies your user.

Setting up User ID has many benefits. You can distinguish whether a user has signed-up, and push notifications can be sent based on the User ID.

Usually, when a user sign-up or log-in, you should execute setUserId.

FlareLane.setUserId("USER_ID");

8. Additional Setup

To use Journeys or Message Personalization, integrate custom data via SDK or API:

Last updated