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 tohttps://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
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.
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 insetCartItem
andsendConversion
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 |
– | |
returnURL |
return_url |
|
totalItems |
cart_item_count |
|
value |
cart_value |
|
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 |
|
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 |
|
campaign_ids |
- | |
campaign_type |
campaign_type |
Note: Must pass the number of all items in the cart, not just the number of distinct products. |
- | cart_data |
|
- | cart_items |
|