Add custom tracking script to the order confirmation page

Overview


If you'd like to add any custom tracking scripts like a javascript snippet into the order confirmation page, you can do so at Settings > Checkout in the Confirmation Page Scripts input field.

These scripts will be automatically be loaded when the Celery checkout page loads.

Disclaimer

Custom Tracking Script Guides

Getting Started

With javascript, you can retrieve the following order-specific data and use them in your tracking scripts:

  • order number (string)
  • buyer email (string)
  • buyer first name (string)
  • buyer last name (string)
  • subtotal (integer -- amount in cents)
  • discount (integer -- amount in cents)
  • shipping cost (integer -- amount in cents)
  • taxes (integer -- amount in cents)
  • total (integer -- amount in cents)
  • discount code (string)
  • currency (string)
  • line items (array of objects)
<script>
  var order = App.getOrder({version: 'v1'});
  
  var orderNumber = order.number;
  var buyerEmail = order.buyer.email;
  var buyerFirstName = order.buyer.first_name;
  var buyerLastName = order.buyer.last_name;
  var subtotal = order.subtotal / 100; // convert to dollars
  var discount = order.discount / 100; // convert to dollars
  var shipping = order.shipping / 100; // convert to dollars
  var taxes = order.taxes / 100; // convert to dollars
  var total = order.total / 100; // convert to dollars
  var discountCode = order.discount_code;
  var currency = order.currency;
  var lineItems = order.line_items;

  // insert your javascript here
</script>

IMPORTANT: Please place a test order to verify that your scripts contain no errors; otherwise, the confirmation page may hang.



Feedback and Knowledge Base