Migration Guide JS v3 to JS v4

CONTENTS

 

Basic Snippet

Changes in base snippet:

  • The URL for our tracking code has changed:
    • https://s3.amazonaws.com/rejoiner/js/v3/t.js has changed to https://cdn.rejoiner.com/js/v4/rejoiner.lib.js.
  • The snippet should be called on every page load in order to enable page views tracking.

Basic JS

<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://cdn.rejoiner.com/js/v4/rejoiner.lib.js';
    var x = document.getElementsByTagName('script')[0];
    x.parentNode.insertBefore(s, x);
})();
</script>

Removed Endpoints

No endpoints were removed in v4

Endpoints Remaining the Same

  • removeCartItem
  • clearCartData
  • filtering endpoints: setExcludeFieldID setExcludeFieldName setIncludeOnlyFieldName setIncludeOnlyFieldID setIncludeOnlyFormID
  • misc. endpoints: persistForms trackNumbers

New Endpoints

Detailed documentation for new endpoints and its params is located in our  Javascript API v4 documentation. This simply serves as a brief introduction to our new endpoints.

Example usage and further explanation can be seen in our  Integration Guide.

Tracking Views

trackPageView

This is a new endpoint allowing you to track URLs of web pages viewed by your customers. It is enabled by default and collects data when our library is loaded. 

Note: For disabling it in specific pages,  please refer to our documentation.

addPageView

New endpoint that is an additional way of manually calling page views for example in SPA applications, where there is no reload in browser when user is navigating through pages.

trackProductView

New endpoint that is part of a new feature that allows you to track products customers were interested in. 

Tracking Cart Data:

startNewOrder

New endpoint allowing you to explicitly start a new order.

Storing Customer Data

setCustomerData

New name endpoint for explicitly setting your customer's name. 

Useful for passing the name of a customer to Rejoiner for a logged user's account.

setCustomerEmail

New e-mail endpoint for for explicitly setting your customer's e-mail. 

Useful whenever you have an e-mail from other sources that are different from forms on your website.

Changed Endpoints

General changes

  • All parameters are now using lowercase_naming_convention.
  • The category parameter in setCartItem and sendConversion has become an array of strings instead of a single string.
  • We've relocated some params in order to improve usability of API.
  • We've introduced some new params to improve tracking accuracy.

Parameter Changes

setCartData

Minor changes, one parameter moved to a separate API call, while 3 parameters changed in name. For more information  click here.

PARAM IN V3 PARAM IN V4 CHANGE
email

Param removed, please use setCustomerEmail endpoint

returnURL return_url

Changed name

totalItems cart_item_count

Changed name

value cart_value

Changed name

customer_order_number customer_order_number

No change

promo promo

No change

setCartItem

Changed the category parameter, which is now an array of strings instead of a single string. For more information click here.

PARAM IN V3 PARAM IN V4 CHANGE
category category

Changed type - now a string array. This allows us to know all the product categories a cart item belongs to.

sendConversion

This endpoint has been updated to improve the accuracy of conversion calls. For more information  click here.

PARAM IN V3 PARAM IN V4 CHANGE
campaign_id campaign_id

Param now accepts an array of IDs instead of a single ID

campaign_ids -

Param removed, please use campaign_id param

campaign_type campaign_type

Param now accepts an array of types instead of a single type. 

Note: Must pass the number of all items in the cart, not just the number of distinct products.

- cart_data

New param in v4 - please see our API documentation for more details

- cart_items

New param in v4 - please see our API documentation for more details

Still need help? Contact Us Contact Us