News! becomes Wooxy. Read a post from the CEO Arrow
January 11, 2022

How to generate JS API script

This essential integration uses a JavaScript snippet, a block of code inserted into your website. It’s a low-impact way to send data to — through your users’ web browsers. While an API integration is more flexible, this is a quick way to get started.

Things to know before you start:

  • We only track activity for users registered on your website after the JS Script is called.
  • We do not track anonymous or unregistered user activity.
  • To update an existing user’s variables, send the JS API call again. You must include their identification and any new attribute values.
  • If the variables already exist in their profile, we’ll overwrite them.
  • If there are any new variables included in the call, we’ll add them to the profile.
  • We do not edit the user’s identification method if the contact is already added to the contact list.
  • A JavaScript API makes it easy to get started but isn’t essential. You may do everything through our REST API.
How to generate JS API script gif

Step-by-step instructions:

  • Navigate to the Integrations page (Menu -> Integrations).

  • Select the “JS code” section.

  • Click the “Add website” button.

  • Select the domain name in the header drop-down menu.

  • Select options and permissions from checkboxes. The code will change depending on the selected options.

  • Click the “Save” button.

  • In the opened tab, please copy the code and paste it on the desired page into your HTML.

  • You can place the same code on several pages – then all the subscribers will be collected in a Default Contact List.

    • IMPORTANT: Keep in mind that at least one unique user identification ( userId| email | phoneNumber ) is required so could match the contact with the one hosted in the Contact List.
  • Download and extract Worker File from the archive and add it to the root directory of your website

    • Alternatively, email all the settings to your Developer if you have a problem adding this code to the website.
  • IMPORTANT: Include JS initialization and user identification snippets on every page in your website immediately before the closing tag to initialize JS API and identify your user.

Options and PermissionsDescription
WebPushEnable Web Push Prompt API method to propose your users to subscribe to Push Notifications in one click.
Contact createYou can create new contacts in the contact list.
Contact updateYou can update data in already added contacts.
EventYou can fire an event and send its data to

IMPORTANT: After generating JS code snippets you can work only with contacts from the default Contact List.