Javascript API Reference

The Rejoiner JavaScript API is an optional add-on for the tracking and conversion tags that enables clients to pass transactional data from the cart. All API calls must be formatted exactly as seen below and they must be placed below the required Rejoiner tracking and/or conversion JavaScript include tags.

Example JavaScript API Usage

<!-- Rejoiner Tracking -->

<script type='text/javascript'>
var _rejoiner = _rejoiner || [];
_rejoiner.push(['setAccount', 'YOUR_REJOINER_SITE_ID_HERE']);
_rejoiner.push(['setDomain', '.yoursiteurl.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': '5999',
        'totalItems': '3',
        'returnUrl': 'http://yoursite.com/regeneratecart'
    }]);

    _rejoiner.push(['setCartItem', {
        'product_id': 'ITM1',
        'qty_price': '39998',
        'name': 'Item Name',
        'description': 'This is a long string of text about the item',
        'price': '19999',
        'image_url': 'http://yoursite.com/path/to/image.jpg'
    }]);

    _rejoiner.push(['setCartItem', {
        'product_id': 'ITM2',
        'name': 'Item 2 Name',
        'description': 'This is a long string of text about item 2',
        'price': '2999',
        'image_url': 'http://yoursite.com/path/to/image2.jpg'
    }]);
</script>

<!-- End Rejoiner Tracking -->
Copy Code ยป
<!-- Rejoiner Tracking -->

<script type='text/javascript'>
	var rejoiner = rejoiner || [];
	rejoiner.setAccount = 'YOUR_REJOINER_SITE_ID_HERE';
	(function() {
	    var s = document.createElement('script'); s.type = 'text/javascript';
	    s.async = true;
	    s.src = 'https://rejoiner.s3.amazonaws.com/js/v2/t.js';
	    var x = document.getElementsByTagName('script')[0];
	    x.parentNode.insertBefore(s, x);
	})();
</script>

<script type='text/javascript'>
	rejoiner.addCartData = [{
        'totalItems' : '2',
        'value' : '23998', //in cents
        'returnUrl' : 'http://yoursite.com/regeneratecart',  //absolute url
        'email' : '[email protected]'
	}];

	rejoiner.addCartItems = [{
        'name': 'Item Name',
        'image_url': 'http://yoursite.com/path/to/image.jpg', // absolute url
        'price': '18499', //in cents
        'product_id': 'ITM1', //required
        'item_qty': '1',
        'qty_price':'18499' //in cents
    },{
        'name': 'Item 2 Name',
        'image_url': 'http://yoursite.com/path/to/image2.jpg', // absolute url
        'price': '5499', //in cents
        'product_id': 'ITM2', //required
        'item_qty': '1',
        'qty_price':'5499' //in cents
	}];
</script>

<!-- End Rejoiner Tracking -->
v1.0 tags are not compatible with the Javascript API.

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 customer if they are logged in
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 or dollars.
customer_order_number No String A unique order number or confirmation number
promo No String A unique promo code or coupon

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 being added to the cart. NOTE: Single or double quotes in product names must be escaped or removed.
description No Integer A description of the item being added to the cart
price No Integer The price of the specific item being added to the cart in cents or dollars
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 or dollars
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

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/Integer The product ID of the cart item to be removed from the order

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'])

Additional Endpoints

Additional endpoints to give you more control over Rejoiner's tracking.

Example Usage Notes
_rejoiner.push(["persistForms"]); If a customer returns to the checkout page, fields will repopulate with the data they entered prior to abandoning.
_rejoiner.push(["trackNumbers"]); Enable Rejoiner to capture phone numbers from your checkout form.
_rejoiner.push(["setExcludeFieldID", ["FieldID1"]]); Filter defined field IDs
_rejoiner.push(["setExcludeFieldName", ["FieldName1", "FieldName2"]]); Filter defined field names
×