Using the product tag with IBM Digital Analytics

If your site is integrated with IBM Digital Analytics, you can use the default implementation of the <cm:product /> tag that HCL Commerce provides. The <cm:product /> tag generates the following IBM Digital Analytics tag: cmCreateProductviewTag.

Tag placement in store pages

Include the <cm:product /> tag in the product display, item display, bundle display, and package display JSP pages. In the page, place the <cm:product /> tag before the <cm:pageview /> tag.

You must also include the tag library in the JSP file before the main page content by using the following code:


<%@ taglib uri="http://commerce.ibm.com/coremetrics" prefix="cm" %>

The data that the <cm:product /> tag generates is different depending on which IBM Digital Analytics tag library type your store uses. To see examples, go to one of the following sections in the following topic:

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:product /> 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.product=new Array();
digitalData.product[0]={};
digitalData.product[0]={attributes:{exploreAttributes:''}, 
  category:{primaryCategory:'3074457345616676683', virtualCategory:''}, 
  productInfo:{productID:'MCL008_0802', productName:'Albini Dark Gray Wool Suit'}};

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:product /> tag generates the following IBM Digital Analytics data tag:
cmCreateProductviewTag(pageId, productID, productName, categoryID, store_id, 
pageCount, masterItemCategory, catIDoverride, attributes)

Example 1:

To pass basic data to IBM Digital Analytics about a product a customer viewed:

Include tag in your store page with the following code:
<cm:product databean="${product}" />
Example of IBM Digital Analyticsdata tag generated:
cmCreateProductviewTag(null, "AS-01", "AromaStar Deluxe", 
"10124", "10101", "N", "10124");

Example 2:

To pass Explore attributes to Coremetrics, use the extraparms parameter (second position):

Note: The examples in this topic use the simplified syntax for specifying extraparms values. You must specify the values using properly escaped JavaScript:
Simplified syntax example
extraparms="value1-_-value2,value3-_-value4"
Properly escaped JavaScript example
extraparms="\"value1-_-value2\",\"value3-_-value4\""

If any of your extraparms values are JavaScript variables, see the syntax rules explained in Syntax for passing JavaScript variables as extra parameters.

Include tag in your store page with the following code:
<cm:product databean="${product}" 
extraparms="null, attr1-_-attr2-_-attr3"/>
Example of IBM Digital Analyticsdata tag generated:
cmCreateProductviewTag(null, "AS-01", "AromaStar Deluxe", "10124", "10101", "N", "10124", null,
 "attr1-_-attr2-_-attr3");

For details about each parameter in the IBM Digital Analytics data tag, see the documentation that is provided by IBM Digital Analytics.