Javascript API Changes

Migrating from a Rejoiner 1 implementation should be straightforward for the Javascript API. Rejoiner 2 is mostly a superset of features from Rejoiner 1 and the API calls are backwards compatible.

Quick Outline

Base Snippet

For most simple integrations, all that will need to be changed is to update the base snippet which loads the Javascript Library. While this snippet remains mostly the same, there are two lines that need to be changed.

  1. You need to replace your Rejoiner 1 Site ID with your Rejoiner 2 Site ID in the setAccount call.
  2. You need to replace the URL of the Rejoiner 1 Javascript Library with the URL of the Rejoiner 2 Javascript Library.
<script type="text/javascript">
var _rejoiner = _rejoiner || [];
_rejoiner.push(['setAccount', 'YOUR-SITE-ID']); //
_rejoiner.push(['setDomain', 'YOUR-DOMAIN']);
(function() {
  var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true;
  s.src = '//'; // <-- REPLACE WITH NEW RJ2 URL
  var x = document.getElementsByTagName('script')[0];
  x.parentNode.insertBefore(s, x);

Application Differences

While the API remains mostly the same, there are some differences in the application regarding how Rejoiner 2 handles the data received from the Javascript Library.

Customer Parameters

Additional customer parameters passed to setCartItem are stored in a metadata field, rather than at the same level as the standardized fields.

New Features

There are some additional new features that may be useful that are highlighted below:

Custom Parameters

In addition to  setCartItem, setCartData accepts custom parameters which are stored in a metadata field.

Additionally, there is a setSessionMetadata call which provides a way to store custom data which does not necessarily apply to carts or cart items.

Custom Dates

There is a new setSessionDate call which provides a way to store some dates related to a customer's session (transaction) that don't necessarily occur where Rejoiner is able to track them, or may occur in the future.

Rejoiner currently does not make any assumptions about these dates, leaving it up to you to decide how to use them (e.g.  delivery_date doesn't necessarily have to be when an item is delivered, it could be a travel date, booking date, etc.)

Currently, the following dates are supported:

  • payment_date
  • fulfillment_date
  • delivery_date

Still need help? Contact Us Contact Us