The following are some key things to note about the Checkout success Javascript event:
- Similar to "Shopping Cart View" in that you are looping through all items, but has the addition of the 'addOrder' line where you should pass over the order details.
- Note we do have certain clients that don't have this data because the order ID is not generated until much later.
- If you fall into the above scenario, just ping your Onboarding Engineer/Technical Project Manager and we can lift the requirement and further advise.
- Should trigger on the completion of the buy process on your website, and stops false Cart Abandon campaigns from going out to a user. (E.g. Fire on Thank you/Receipt Confirmation Page)
- Note Checkout Success Event will fail if a comma is sent as a value in price data. Periods are only accepted for this value.
Checkout success event details
The checkout success action will tell us if a purchase has been made. Here you will need to add order information, loop through the items, and set a new action. If you will be sending order data via JavaScript, please use the ‘Checkout Success with Order Data’ snippet instead.
- The order_id should correspond to the order’s unique record ID within your database
/*** EVENT SPECIFIC CODE ***/
_rsq.push(['_addOrder', {'id': 'order_id', 'total': 'order_total'}]); // replace order_id and order_total with your dynamic order_id and order_total variables
for (condition) { // replace condition with your loop parameters for all items in order
_rsq.push(['_addItem', {
'id':'item_id', // replace item_id with your dynamic item_id variable
'name':"item_title", // replace item_title with your dynamic item_title variable
'price':'item_price'// replace item_price with your dynamic item_price variable
}]);
}
_rsq.push(['_setAction', 'checkout_success']);
/*** END EVENT SPECIFIC CODE ***/
Checkout success code sample
<!-- RetentionScience start -->
<script type='text/javascript'>
var _rsq = _rsq || [];
_rsq.push(['_setSiteId', 'site_id']); // replace site_id with your static Site ID
_rsq.push(['_enableOnsite']);
if (condition) { // replace condition with your parameters for checking if a user is logged in
_rsq.push(['_setUserId', 'user_id']); // replace user_id with your dynamic user_id variable
_rsq.push(['_setUserEmail','user_email']); // replace user_email with your dynamic user_email variable
}
/*** EVENT SPECIFIC CODE ***/
_rsq.push(['_addOrder', {'id': 'order_id', 'total': 'order_total'}]); // replace order_id and order_total with your dynamic order_id and order_total variables
for (condition) { // replace condition with your loop parameters for all items in order
_rsq.push(['_addItem', {
'id':'item_id', // replace item_id with your dynamic item_id variable
'name':"item_title", // replace item_title with your dynamic item_title variable
'price':'item_price'// replace item_price with your dynamic item_price variable
}]);
}
_rsq.push(['_setAction', 'checkout_success']);
/*** END EVENT SPECIFIC CODE ***/
_rsq.push(['_track']);
(function() {
var rScix = document.createElement('script');
rScix.type = 'text/javascript';
rScix.async = true;
rScix.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'd1stxfv94hrhia.cloudfront.net/waves/v3/w.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(rScix);
})();
</script>
<!-- RetentionScience end -->
Checkout success event data sample
Comments
0 comments
Please sign in to leave a comment.