Use the order tag with IBM Digital Analytics
If the site is integrated with IBM Digital Analytics, we can use the default implementation of the <cm:order /> tag that WebSphere Commerce provides. The <cm:order /> tag generates two IBM Digital Analytics data tags: cmCreateShopAction9Tag and cmCreateOrderTag.
Tag placement in the store JSP page
Include the <cm:order /> tag in the order confirmation page. In the page, place the <cm:order /> tag before the <cm:pageview /> tag.
We must also include the tag library in the store JSP page before the main page content. Use the following code:
<%@ taglib uri="http://commerce.ibm.com/coremetrics" prefix="cm" %>
The data output by the <cm:order /> tag differs depending on which IBM Digital Analytics tag library type the store uses. To see examples, go to one of the following sections:
Example of tag usage and output for IBM Digital Data Exchange (DDX)
If the WebSphere Commerce store is integrated with DDX to simplify collecting analytics data, the <cm:order /> tag generates data into the digitalData JavaScript object that is sent to DDX. DDX can then relay the data to IBM Digital Analytics. The generated data that in this JavaScript object can look like the following output:digitalData.transaction={attributes:{exploreAttributes:'', extraFields:'-_--_--_--_--_--_--_--_--_--_--_--_-Save $25 on all orders over $200 USD-_--25.00-_-'}, profile:{address:{city:'City', postalcode:'90210', state_province:'CA'}, profileInfo:{profileID:'-1000'}}, total:{basePrice:'1110.00', currency:'USD', shipping:'0.00'}, transactionID:'11001'}; digitalData.transaction.item=new Array(); digitalData.transaction.item[0]={}; digitalData.transaction.item[0]={attributes:{exploreAttributes:'', extraFields:'-_--_--_--_--_--_--_--_--_--_--_--_--_-'}, category:{primaryCategory:'3074457345616676683', virtualCategory:''}, currency:'USD', price:'977.97', productInfo:{productID:'MCL008_0802', productName:'Albini Dark Gray Wool Suit'}, quantity:'1'}; digitalData.transaction.item[1]={}; digitalData.transaction.item[1]={attributes:{exploreAttributes:'', extraFields:'-_--_--_--_--_--_--_--_--_--_--_--_--_-'}, category:{primaryCategory:'3074457345616676695', virtualCategory:''}, currency:'USD', price:'132.03', productInfo:{productID:'CAC024_2401', productName:'Widescreen LCD Monitor'}, quantity:'1'}; cmSetupOther({"cm_currencyCode":"USD"});
For more information about integrating with DDX, see IBM Digital Data Exchange integration.
Examples of tag usage: for the custom IBM Digital Analytics library
The <cm:order /> tag generates two IBM Digital Analytics data tags:
- For each item in the shopping cart, the following IBM Digital Analytics tag is generated:
cmCreateShopAction9Tag (productId, productName, productQuantity, productPrice, customerId, orderId, orderTotal, categoryId, store_id, currency, account_name, contract_name, masterItemCategory, catIDoverride, attributes)
- For order summary information, the following IBM Digital Analytics tag is generated:
cmCreateOrderTag (orderId, orderTotal, orderShipping, customerId, customerCity, customerState, customerZip, store_id, currency, promotion_name, promotion_discount, promotion_code, attributes)
Example 1:
To pass the basic order summary and shopping cart item data to IBM Digital Analytics:
Include tag in your
store page with the following code:If the store uses data beans and URL commands for order runtime functions, use the databean parameter: <cm:order databean="${order_OrderDataBean}" />
If the store uses web services for order runtime functions, use the orderType parameter:
<cm:order orderType="${order}" />
Example of IBM Digital Analytics
data tags generated:For shopping cart item data: cmCreateShopAction9Tag("FULO-01", "White Fabric Roll Arm Chaise", "1", "355.45", "7002", "35002", "355.45", "10104", "10101", "USD", null, null, "10104");
For order summary information:
cmCreateOrderTag("35002", "355.45", "6.44", "7002", "Atlanta", "GA", "23456", "10101", "USD", "Furniture Category Discount|Save 10%|Flat Shipping", "-90.0|-36.0|-0.94", "||");
Example 2:
To include the tax in the unit price and order total that is sent to IBM Digital Analytics, use the includeTaxInUnitPrice and includeTaxInTotalPrice parameters:
Include tag in your
store page with the following code:If the store uses data beans and URL commands for order runtime functions: <cm:order databean="${order_OrderDataBean}" includeTaxInUnitPrice="true" includeTaxInTotalPrice="true" />
If the store uses web services for order runtime functions:
<cm:order orderType="${order}" includeTaxInUnitPrice="true" includeTaxInTotalPrice="true" />
Example of IBM Digital Analytics
data tags generated:For shopping cart item data: (same as Example 1, except that the productPrice parameter value includes tax)
For order summary information:
(same as Example 1, except that the orderTotal parameter value and shipping charges includes tax)
Note: The following examples use the simplified syntax for specifying extraparms and orderExtraparms values. We must specify the values using properly escaped JavaScript:
- Simplified syntax example
- extraparms="value1,value2"
- Properly escaped JavaScript example
- extraparms="\"value1\",\"value2\""
Example 3:
To pass IBM Digital Analytics Explore attributes to the IBM Digital Analytics cmCreateShopAction9Tag and cmCreateOrderTag, use the extraparms parameter (second position) and the orderExtraparms parameter (first position):
Include tag in your
store page with the following code:If the store uses data beans and URL commands for order runtime functions: <cm:order databean="${order_OrderDataBean}" extraparms="null,attr1-_-attr2-_-attr3" orderExtraparms="attr4-_-attr5-_-attr6"/>
If the store uses web services for order runtime functions:
<cm:order orderType="${order}" extraparms="null,attr1-_-attr2-_-attr3" orderExtraparms="attr4-_-attr5-_-attr6"/>
Example of IBM Digital Analytics
data tags generated:For shopping cart item data: cmCreateShopAction9Tag("FULO-01", "White Fabric Roll Arm Chaise", "1", "355.45", "7002", "35002", "355.45", "10104", "10101", "USD", null, null, "10104", null, "attr1-_-attr2-_-attr3");
For order summary information:
cmCreateOrderTag("35002", "355.45", "6.44", "7002", "Atlanta", "GA", "23456", "10101", "USD", "Furniture Category Discount|Save 10%|Flat Shipping", "-90.0|-36.0|-0.94", "||", "attr4-_-attr5-_-attr6");
Example 4:
To pass both IBM Digital Analytics Explore attributes and more data for custom reports to the IBM Digital Analytics cmCreateShopAction9Tag and cmCreateOrderTag, use the extraparms parameter (second and third position) and the orderExtraparms parameter (first and second position):
Include tag in your
store page with the following code:If the store uses data beans and URL commands for order runtime functions: <cm:order databean="${order_OrderDataBean}" extraparms="null, attr1-_-attr2-_-attr3,exField1-_-exField2-_-exField3" orderExtraparms="attr4-_-attr5-_-attr6,exField4-_-exField5-_-exField6"/
If the store uses web services for order runtime functions:
<cm:order orderType="${order}" extraparms="null, attr1-_-attr2-_-attr3,exField1-_-exField2-_-exField3" orderExtraparms="attr4-_-attr5-_-attr6,exField4-_-exField5-_-exField6"/
Example of IBM Digital Analytics
data tags generated:For shopping cart item data: cmCreateShopAction9Tag("FULO-01", "White Fabric Roll Arm Chaise", "1", "355.45", "7002", "35002", "355.45", "10104", "10101", "USD", null, null, "10104", null, "attr1-_-attr2-_-attr3","exField1-_-exField2-_-exField3");
For order summary information:
cmCreateOrderTag("35002", "355.45", "6.44", "7002", "Atlanta", "GA", "23456", "10101", "USD", "Furniture Category Discount|Save 10%|Flat Shipping", "-90.0|-36.0|-0.94", "||", "attr4-_-attr5-_-attr6","exField4-_-exField5-_-exField6");
For details about each parameter in the IBM Digital Analytics data tag, see the documentation that is provided by IBM Digital Analytics.
Related concepts
Passing extra data to IBM Digital Analytics with the extraparms parameter
Comparison of extra parameters for IBM Digital Analytics tags
IBM Digital Analytics JavaScript library types: standard and custom
Related reference
Order tag