JavaScript API Endpoints v4

This document describes the API Endpoints of the version 4 Javascript tracking code. To integrate Rejoiner with your website, please review our Implementation Guide here.

Note: If your website is using v3, you can see the API Endpoints for that version  here
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

Tracking Page View:

Tracking Cart Data:

Tracking Conversions:

Storing Customer Data:

Subscribe to List:

Other:

 

Overview

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

Tracking Page View

trackPageView

The trackPageView endpoint is intended for tracking a single page view.

Note

By default, the trackPageView endpoint will run on every page when the tracking code is loaded. In order to disable that functionality on pages you don't want to track, you will need to disable tracking using the code below:

_rejoiner.push(['trackPageView', false]);
PARAM NAME REQUIRED TYPE NOTES
url Yes String Full URL of the current page (including the query string).

addPageView

The addPageView endpoint works the same way as above trackPageView, HOWEVER, this endpoint is intended for manually calling a page view without reloading a page – which is useful for SPA applications.

PARAM NAME REQUIRED TYPE NOTES
url Yes String Full URL of the current page (including the query string).

trackProductView

The trackProductView endpoint tracks information about a viewed product.

PARAM NAME REQUIRED TYPE NOTES
product_id Yes String A SKU or unique product identifier of the product
name No String The name of the viewed product. Single or double quotes in product names must be escaped or removed.
category Yes String Array A list of categories a product belong to.
price No Integer The unit price of the product in cents.
image_url No String An absolute URL that references a product image for the specific item.
product_url No String An absolute URL referencing the product page of the viewed item.

Tracking Cart Data:

startNewOrder

The startNewOrder endpoint explicitly starts an order when user visits a checkout page. 

setCartData

The setCartData endpoint stores data about a current order. It also implies starting an order if an order has not been started before.

PARAM NAME REQUIRED TYPE NOTES
cart_value No Integer Value of the cart in cents.
cart_item_count No Integer Total number of items in cart.
ie: The number of all items in the cart, not just the number of distinct products
customer_order_number No String External ID of this order.
promo No String Promotional code for this order.
return_url No String Regeneration URL that the customer may use to return to the cart.

setCartItem

The setCartItem endpoint adds a new cart item to the current session. It also implies starting an order if an order has not been started before.

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.
category Yes String Arrays The product categories a cart item belongs to.
price No Integer The unit price of the specific item being added to the cart in cents.
item_qty No Integer The unit count of the specific item being added to the cart in cents.
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.
image_url No String An absolute URL that references a product image for the specific item being added to the cart.

Any additional arguments will be stored as custom fields (string values).

removeCartItem

The removeCartItem removes tracked cart item matching given ID.

Note: You must refire setCartData with updated parameters after using the removeCartItem endpoint.
PARAM NAME REQUIRED TYPE NOTES
product_id Yes String ID of the product that should be removed.

Tracking Conversions:

sendConversion

The sendConversion endpoints converts an order. Optional parameters may be specified to match specified to match specific campaigns when attributing the conversion to a Rejoiner campaign.

While it's possible to call the conversion tracking endpoint without any arguments,  we highly encourage you to call sendConversion with cart_data and cart_items parameters filled
Doing that  will give you greater accuracy as to what has been converted, so please fill these parameters whenever it is possible.
PARAM NAME   REQUIRED TYPE DESCRIPTION
campaign_id No String List of campaign IDs specified by user.

 Deprecated

campaign_type No String List of campaign types specified by user.

 Deprecated

cart_data   No Object Stores data about current order (same object as in setCartData endpoint)
cart_value No Integer Value of the cart  in cents.
cart_item_count No Integer Total number of items in cart.
ie: The number of all items in the cart, not just the number of distinct products.
customer_order_number No Integer External ID of this order.
promo No
Integer Promotional code for this order.
return_url No Integer General link to order-related page, like review request, order summary page, order invoice page, etc.
cart_items   No Array of Objects Stores data about cart items of the current session (Array of the same objects as in setCartItem endpoint)
product_id Yes String Unique ID of the product.
name No String Name of the item in cart.
description No String Full description of the item in cart.
category Yes Array of Strings Categories the cart item belongs to.
price No Integer The unit price of the cart item  in cents.
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 product URL for the cart item.
image_url No String An absolute image URL for the cart item.
Any additional arguments (in cart_items) will be stored as custom fields (string values).

Example Usage:

<script type='text/javascript'>
_rejoiner.push(["sendConversion",
    {
        cart_data: {
            'cart_value': 79996,
            'cart_item_count': 2
        },
        cart_items: [
            {
                'name': 'Item Name',
                'product_id': 'ITM1',
                'price': 19999,
                'product_url': 'http://yoursite.com/productpage',
                'category': ['televisions', 'smart_tv'],
                'item_qty': 2,
                'qty_price': 39998,
                'image_url': 'http://yoursite.com/path/to/image.jpg'
            },
            {
                'name': 'Item Name2',
                'product_id': 'ITM2',
                'price': 19999,
                'product_url': 'http://yoursite.com/productpage2',
                'category': ['televisions'],
                'item_qty': 2,
                'qty_price': 39998,
                'image_url': 'http://yoursite.com/path/to/image2.jpg'
            }
        ]
    }
]);

</script>

clearCartData

The clearCartData deletes all related cart data and cart item objects, and in addition:

  • reset order value to 0,
  • stops order processing,
  • stops recovery efforts.

(No params)

Storing Customer Data

setCustomerData

The setCustomerData endpoint stores normalized data about the customer.

PARAM NAME REQUIRED TYPE NOTES
age No Integer Age of the customer.
gender No enum:
string
m, male,
f, female  
Gender of the customer.
language No String Language code of the customer.
Supported codes: ISO 639-1, ISO 639-2/T, ISO 639-2/B ZY
name No String The First Name of the customer.
status No String A customer's status.

setCustomerEmail

The setCustomerEmail endpoint stores email address of the customer.

PARAM NAME REQUIRED TYPE NOTES
email Yes String Email address of the customer.

Example Usage:

_rejoiner.push(['setCustomerEmail', { 'email' : 'example@rejoiner.com' } ]);

Subscribe to List

subscribeToList

The subscribeToList endpoint adds a contact to a specified list. You will need to be able to get the unique ID of the Rejoiner List you want to subscribe contacts to. Please see our instructions on  how to find a List's unique ID.

PARAM NAME REQUIRED TYPE NOTES
email Yes String Email address that should be subscribed to the list.
list_id Yes String The ID of the list to subscribe the email to.
first_name No String The first name of the contact.
custom_1 No String The value of custom_1 parameter.
custom_2 No String The value of  custom_2 parameter.
custom_3 No String The value of  custom_3 parameter.
custom_4 No String The value of  custom_4 parameter.
custom_5 No String The value of  custom_5 parameter.
custom_6 No String The value of  custom_6 parameter.

Example Usage:

_rejoiner.push(['subscribeToList', {
  email: 'john.doe@gmail.com',
  list_id: '12345',
  first_name: 'John',
  custom_1: 'Custom 1 Param',
  custom_2: 'Custom 2 Param',
  custom_3: 'Custom 3 Param',
  custom_4: 'Custom 4 Param',
  custom_5: 'Custom 5 Param',
  custom_6: 'Custom 6 Param',
}]);

Others

Filtering endpoints

If you don't want to scan all forms for customer data or want to specify which form should be scanned, you can use our filtering endpoints. For given HTML markup with two forms:

<form id="formId1">
    <input type="text" id="fieldId1" name="fieldName1" />
    <input type="text" id="fieldId2" name="fieldName2" />
    <input type="password" id="fieldId3" name="fieldName3" />
</form>
<form id="formId3">
    <input type="text" id="fieldId4" name="fieldName4" />
    <input type="text" id="fieldId5" name="fieldName5" />
    <input type="password" id="fieldId6" name="fieldName6" />
</form>

calling endpoints in this order:

Note: To use the forms filtering feature, the snippet below shows the suggested order of precedence for API calls.
EXAMPLE USAGE DESCRIPTION
_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

Form Filtering Example:

_rejoiner.push(["setIncludeOnlyFormID", ["formId1", "formId2"]]); // formId2 doesn't exist, will be skipped
_rejoiner.push(["setIncludeOnlyFieldID", ["fieldId1", "fieldId2"]);
_rejoiner.push(["setIncludeOnlyFieldName", ["fieldName1", "fieldName3"]]);
_rejoiner.push(["setExcludeFieldID", ["fieldId1"]]);

will work as follows:

  • setIncludeOnlyFormID filter is checked first and as a result inputs with id ["fieldId1", "fieldId2", "fieldId3"] are passed to the form scanning engine (there is no formId2 so it is skipped)
  • Now you can further filter fields – as a list passed with setIncludeOnlyFieldID; as a result only inputs with id ["fieldId1", "fieldId2"] will be processed
  • After that you can filter even more using setIncludeOnlyFieldName where as a result only fieldId1 will be processed 
  • Lastly, you can run the setExcludeFieldID filter, which (in the scenario above) will result in an empty list of fields so the specified field(s) is not scanned

Misc. Endpoints

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

EXAMPLE USAGE DESCRIPTION
_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