Using the order tag with IBM Digital Analytics

If your site is integrated with IBM Digital Analytics, you can use the default implementation of the <cm:order /> tag that HCL 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.

You 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 your 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 your HCL 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:
  1. 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)
  2. 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 your store uses data beans and URL commands for order runtime functions, use the databean parameter:
<cm:order databean="${order_OrderDataBean}" />

If your store uses web services for order runtime functions, use the orderType parameter:

<cm:order orderType="${order}" /> 
Example of IBM Digital Analyticsdata 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 your store uses data beans and URL commands for order runtime functions:
<cm:order databean="${order_OrderDataBean}"
includeTaxInUnitPrice="true" includeTaxInTotalPrice="true" />

If your store uses web services for order runtime functions:

<cm:order orderType="${order}" 
    includeTaxInUnitPrice="true" includeTaxInTotalPrice="true" />
Example of IBM Digital Analyticsdata 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. You 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 your 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 your 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 Analyticsdata 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 your 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 your 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.