The following are some key things to note about the Checkout success with order data Javascript event:
- Exactly the same as "Checkout Success", except you can add more Order information into the wave.
- We do not recommend using this approach/event, and it is only available for backup scenarios when core data and API routes are not viable.
Checkout success with order data 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. This snippet of code will allow Retention Science to capture order data via JavaScript instead of flat files.
- Required parameters: order_id, total_price, ordered_at, order_valid
- ordered_at datetime format in UTC: yyyy-mm-dd hh:mm:ss
Checkout success with order data code sample
/*** EVENT SPECIFIC CODE ***/ _rsq.push(['_setOrderProperties', { 'order_id': 'order_id', 'total_price': 'order_total', 'user_id': 'user-record-id', 'ordered_at': 'order_datetime', 'order_valid': 'true', 'order_status': 'completed', 'subscription': 'false', 'discount_amount': 'order_discount', 'shipping_amount': 'order_shipping', 'tax_amount': 'order_tax' }]); // replace order_id with your dynamic order_id variable // replace order_total with your dynamic order_total variable // replace user-record-id with the user_id being passed in other JS events // replace order_datetime with your dynamic order_datetime variable // replace order_discount with your dynamic order_discount variable // replace order_shipping with your dynamic order_shipping variable // replace order_tax with your dynamic order_tax variable
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
}
_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);
})();
Comments
0 comments
Please sign in to leave a comment.