Skip to main content
The SendX JS Client library enables you to seamlessly capture contacts, assign tags, and update custom fields directly from your website. This guide walks you through installing the snippet, sending asynchronous API requests, and using available methods like identify and track to personalise and automate your marketing workflows.

Installing Javascript Snippet

To use SendX JS Client library you need to have SendX snippet installed on your website. Each SendX team account has a unique snippet that can be found under Settings > SendX Snippet Snippet. Here’s an example snippet, replace the YOUR_TEAM_ENCRYPTED_ID with your team’s encrypted Id.
SendX Javascript snippet gets loaded asynchronously and hence it won’t affect page load time of your website.

Sending API Requests

All requests follow the same pattern.
API requests are executed asynchronously so you can safely place them anywhere on the page. The conventions are similar to what google analytics API follows.

API Methods

SendX Javascript Client library has two methods:
  • Identify
  • Track

Identify API Method

Identify API Method is used to attach data to a visitor. If a contact is not yet created then we will create the contact. In case contact already exists then we update it.

Tags:

  • tags is an array of strings.
  • If a tag does not exist, it is automatically created and associated with the contact.

Custom Fields:

  • If a custom field does not exist, it will be created with **type **string and the value will be set.
  • If the field already exists, the value will be updated.
  • Custom fields can also have type number. To modify them incrementally, use:
    • "customField_name": "++34" → Increases the current value by 34
    • "customField_name": "--10" → Decreases the current value by 10
    If the custom field does not already exist, the numeric value (e.g. 34) is directly set as the starting value.
Identify Calls are Additive
The identify call does not delete any previously set properties.

API Call A

identify.js

API Call B

identify.js
Then the final contact will look like this:
Values are merged, not overwritten wholesale. You only need to send what you want to add or update.

Identify Properties

In case email of an already existing contact needs to be updated then specify current email under email property and updated email under newEmail property.

Track API Method

Track API Method is used to track a contact. You can add or remove tags from a contact using this API.

Track Properties