JavaScript API Endpoints

The API endpoints outlined below are optional add-ons for the main Rejoiner tracking tag (v3). All API calls must be formatted exactly as seen below.

If you're jumping right into available endpoints, please  review our API usage examples first. That will provide you some context for how and when endpoints can be used.

Available Endpoints

setCartData Overview

The setCartData endpoint is intended for passing order level data about the abandoned transaction.

PARAM NAME REQUIRED TYPE NOTES
email No String The email address of a registered or returning customer.
returnUrl No String A unique url that should regenerate the cart.
totalItems No Integer The total number of items in the cart.
value No Integer This is the total value of the cart in cents.
customer_order_number No String A unique order number.
promo No String A unique promo code or coupon.
Example Usage
<script type='text/javascript'>
var _rejoiner = _rejoiner || [];
_rejoiner.push(['setAccount', 'your site ID here']);
_rejoiner.push(['setDomain', '.yourdomain.com']);
(function() {
    var s = document.createElement('script'); s.type = 'text/javascript';
    s.async = true;
    s.src = 'https://s3.amazonaws.com/rejoiner/js/v3/t.js';
    var x = document.getElementsByTagName('script')[0];
    x.parentNode.insertBefore(s, x);
})();
</script>
<script type='text/javascript'>
    _rejoiner.push(['setCartData', {
        'value': '79996', 
        'totalItems': '4',
        'email': 'customer@example.com' //customer's email address
    }]);
</script>

setCartItem Overview

The setCartItem endpoint is intended for passing individual characteristics about specific items in the cart.

PARAM NAME REQUIRED TYPE NOTES
product_id Yes String A SKU or unique product identifier from your system.
name No String The name of the item in cart. Single or double quotes in product names must be escaped or removed.
description No String A full description of the item being added to the cart. Single or double quotes in descriptions must be escaped or removed.
price No Integer The unit price of the specific item being added to the cart in cents.
image_url No String An absolute URL that references a product image for the specific item being added to the cart.
item_qty No Integer The quantity of an item in the cart.
qty_price No Integer The unit price X quantity of an item in cents.
product_url No String An absolute URL referencing the product page for the cart item.
category No String The product category of a cart item.
Example Usage
<script type='text/javascript'>
var _rejoiner = _rejoiner || [];
_rejoiner.push(['setAccount', 'your site ID here']);
_rejoiner.push(['setDomain', '.yourdomain.com']);
(function() {
    var s = document.createElement('script'); s.type = 'text/javascript';
    s.async = true;
    s.src = 'https://s3.amazonaws.com/rejoiner/js/v3/t.js';
    var x = document.getElementsByTagName('script')[0];
    x.parentNode.insertBefore(s, x);
})();
</script>
<script type='text/javascript'>
    _rejoiner.push(['setCartData', {
        'value': '79996', 
        'totalItems': '4',
        'email': 'customer@example.com' //customer's email address
    }]);
  _rejoiner.push(['setCartItem', {
        'name': 'Item Name',
        'product_id': 'ITM1', //required
        'price': '19999', 
        'product_url': 'http://yoursite.com/productpage', //absolute url
        'category': 'televisions', 
        'item_qty': '2', 
        'qty_price': '39998', 
        'image_url': 'http://yoursite.com/path/to/image.jpg' //absolute url
    }]);
 _rejoiner.push(['setCartItem', {
        'name': 'Item Name',
        'product_id': 'ITM2', //required
        'price': '19999', 
        'product_url': 'http://yoursite.com/productpage', //absolute url
        'category': 'televisions', 
        'item_qty': '2', 
        'qty_price': '39998', 
        'image_url': 'http://yoursite.com/path/to/image.jpg' //absolute url
    }]);
</script>

setCustomerData Overview

The setCustomerData endpoint is intended for passing individual characteristics of specific customers.

PARAM NAME REQUIRED TYPE NOTES
age No Int The age of the customer
gender No string Gender of the customer ("male"/"m", "female"/"f" – case insensitive)
language No string Language code (we support two-letter ISO 639-1 codes and three-letter ISO 639-2/T* codes – case insensitive)
name No string The name of the customer
Example Usage
_rejoiner.push(['setCustomerData', {age: 18}]);

sendConversion Overview

The sendConversion endpoint is responsible for notifying Rejoiner when a customer completes a goal.

PARAM NAME REQUIRED TYPE NOTES
campaign_id No String ID of the campaign that should be converted.
campaign_ids No String Array IDs of the campaigns that should be converted.
campaign_type No String Type of the campaign that should be converted ("abandonment" or "conversion").

Example Usage

If abandonment & post-conversion campaigns all target the same confirmation page, use:
_rejoiner.push(['sendConversion']);
If abandonment campaigns target "Page A" and post-conversion campaigns target "Page B," use the following for each campaign type:
_rejoiner.push(["sendConversion", {campaign_type: "abandonment"}]);
If one abandonment campaign targets "Page A" and another abandonment campaign targets "Page B," you must declare the campaign ID(s) of each campaign.
_rejoiner.push(["sendConversion", {campaign_ids: ["517e97c518484d2b1a000000"]}]);

removeCartItem Overview

The removeCartItem endpoint programatically deletes cart items, but does not change the total value of the order. It should be followed up with an updated setCartData call.

PARAM NAME REQUIRED TYPE NOTES
product_id Yes String The product ID/SKU of the cart item to be removed from the cart
Example Usage
_rejoiner.push(['removeCartItem', {'product_id': '4'}]);

clearCartData Overview

The clearCartData endpoint deletes all related cartData and cartItem objects and in addition:

  • resets order value to 0
  • stops order processing
  • stops recovery efforts (no emails will be sent for an order that has been cleared)

Note: The cleared order remains visible on your dashboard as abandoned (only if an email address was captured) and will become reactivated when any JavaScript action occurs. If, in that case, the order is abandoned yet again, the resulting recovery effort will not be subject to suppression rules, however it will not re-send emails that were already sent in the first recovery effort.

Example Usage
_rejoiner.push(['clearCartData'])

Filtering Endpoints

Filtering endpoints give you the ability to selectively filter and include certain fields for the purposes of Rejoiner tracking.

EXAMPLE USAGE NOTES
_rejoiner.push(["setExcludeFieldID", ["FieldID1"]]); Filter defined field IDs
_rejoiner.push(["setExcludeFieldName", ["FieldName1", "FieldName2"]]); Filter defined field names
_rejoiner.push(["setIncludeOnlyFieldName", ["FieldID1"]]); Track only defined fields
_rejoiner.push(["setIncludeOnlyFieldID", ["FieldName1", "FieldName2"]]); Track only defined field IDs
_rejoiner.push(["setIncludeOnlyFormID", ["myformid1", "myformid2"]]); Track only defined forms

Misc. Endpoints

These are additional endpoints to give you a higher level of control of Rejoiner's tracking.

EXAMPLE USAGE NOTES
_rejoiner.push(["persistForms"]); If a customer returns to the checkout page, fields will repopulate with the data the customer entered prior to abandoning.
_rejoiner.push(["trackNumbers"]); Enable Rejoiner to capture phone numbers from your checkout form.

Still need help? Contact Us Contact Us