All Collections
Get Order Data for Google Analytics or other eCommerce Order Tracking
Get Order Data for Google Analytics or other eCommerce Order Tracking
Updated over a week ago

As you may need to be able to track orders as they flow from Google Ad Words or other traffic leads, we provide you with the ability to access the order data via javascript.

Upon viewing the order receipt, in this case new orders will be at order_receipt.aspx?flag=new, you will have access to both an item array of objects containing an array of all items from the order and transaction object containing specific info for this order.

Example item array:

var item = [{
   id: 00000,
   name: "example name",
   sku: "examplesku",
   attribute: "exampleAttribute",
   price: 000,
   quantity: 1
}, {
   id: 00000,
   name: "example name",
   sku: "examplesku",
   attribute: "exampleAttribute",
   price: 000,
   quantity: 1

Example transaction object:

var transaction = { 
   id: 00000,
   affiliation: 0,
   revenue: 000,
   shipping: 0,
   tax: 0,
   city: "chicago",
   state: "IL",
   country: "US"

You can now leverage this data to push to Google Analytics or other tools. Place your code in the footer of the Page Layout and load specifically when at order_receipt.aspx?flag=new.

The example code below is formatted to capture pageviews and ecommerce data using Google Analytics:

// ga pageview tracking
ga('create', 'UA-00000000-0', 'auto', {'name': 'exampleTracker'});
ga('exampleTracker.send', 'pageview');// ga ecommerce tracking
var isCommerceReady = validatePage();function validatePage() {
   var isValidPath = window.location.pathname === '/commerce_receipt.aspx';
   var isValidParam = === '?flag=new';
   var varsExists = window.item !== undefined && window.transaction !== undefined;   if(isValidPath && isValidParam && varsExists) {
      return true;
   } else {
      return false;
};if(isCommerceReady) {
   ga('exampleTracker.require', 'ecommerce');   for(i = 0; i 
Did this answer your question?