DOCUMENTATION

Javascript API

Javascript API

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

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', 'abc123xs']); // <-- REPLACE WITH RJ2 SITE ID
_rejoiner.push(['setDomain', 'rj2.rejoiner.com']);
(function() {
  var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true;
  s.src = '//cdn.rejoiner.com/js/v4/rj2.lib.js'; // <-- REPLACE WITH NEW RJ2 URL
  var x = document.getElementsByTagName('script')[0];
  x.parentNode.insertBefore(s, x);
})();
</script>

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
Back to Top