Welcome to the DEMO & EXAMPLES web site for Open Web Analytics. The data contained in the demos and examples comes from the live usage of this site. Historical data is truncated periodically.

E-commerce Transaction

This example page shows how to log an e-commerce transaction. It is also the fourth and final step in an example conversion funnel that we have defined for this web site. This page is also the destination URL for the "goal". In real life this page might be the "thank You" page shown after you submit a web form, or the receipt page shown at the end of an e-commerce transaction flow.

In order to demonstrate the e-commerce features of OWA, we are going to pretend that this is the receipt page that is shown after you buy something.

Here is our pretend receipt:

Widgets.com - Order Detail

Order Number:10522548721511013493
Sub Total:$42.60
Tax:$3.40
Shipping:$8.95
Total:$54.95

Items Purchased

Item Name SKU Quantity Price
Large Widget EX4323 2 $10.20
Medium Widget EX5893 1 $5.50
Small Widget EX2229 2 $3.35
Wooden Widget EX4325 4 $2.25

Here's the Javascript used to track this e-commerce transaction:

var owa_baseUrl = 'http://domain.com/path/to/owa/';
var owa_cmds = owa_cmds || [];
owa_cmds.push(['setSiteId', '__YOUR_SITE_ID__']);
owa_cmds.push(['trackPageView']);
owa_cmds.push(['trackClicks']);
owa_cmds.push(['trackDomStream']);
owa_cmds.push(['addTransaction', 
	'10522548721511013493',		        // the id of the order, comes from your ecommerce system -required
	'Widgets.com Online Store',	// the source or store name that originated the transaction
	'54.95',			// the total amount of revenue - required
	'3.4',        			// amount of tax
	'8.95',   			// amount of shipping
	'paypal',                    	// transaction gateway name
	'United States',             	// country of purchaser
	'CA',                        	// state of purchaser
	'Palo Alto'                  	// city of purchaser
]);

owa_cmds.push(['addTransactionLineItem', 
			'10522548721511013493',		// order id 
			'EX4323',		// sku
			'Large Widget',		// product name
			'widgets',		// product category
			'10.2',			// unit price
			'2'			// quantity
]);

owa_cmds.push(['addTransactionLineItem', 
			'10522548721511013493',		// order id 
			'EX5893',		// sku
			'Medium Widget',	// product name
			'widgets',		// product category
			'5.5',			// unit price
			'1'			// quantity
]);

owa_cmds.push(['addTransactionLineItem', 
			'10522548721511013493',		// order id 
			'EX2229',		// sku
			'Small Widget',		// product name
			'widgets',		// product category
			'3.35',			// unit price
			'2'			// quantity
]);

owa_cmds.push(['addTransactionLineItem', 
			'10522548721511013493',		// order id 
			'EX4325',		// sku
			'Wooden Widget',	// product name
			'widgets',		// product category
			'2.25',			// unit price
			'4'			// quantity
]);

owa_cmds.push(['trackTransaction']);

(function() {
	var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;
	_owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';
	var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);
}());