Using the element tag with IBM Digital Analytics

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

Tag placement in store pages

Include the <cm:element /> tag in the page that loads as a result of the customer interacting with the page element. In that page, place the <cm:element /> before the <cm:pageview /> tag.

You must also include the tag library in the JSP file for the page before the main page content. Use the following code:


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

Typically, the <cm:element /> tag is intended to track customer interactions with parts of a page, rather than interactions that cause a full page to load. For example, this tag is used in HCL Commerce starter stores to track customer interactions with the product fast finder. In this case, you can use the <cm:element /> tag with the parameter returnAsJSON set to true to get the element data in JSON format. Then, you must write logic to call the IBM Digital Analytics cmCreateElementTag function to send the JSON-format data to IBM Digital Analytics. For more information, see Digital Analytics integration with Web 2.0 starter stores.

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:element /> 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.component=new Array();
digitalData.component[0]={};
digitalData.component[0]={attributes:{exploreAttributes:''}, 
       category:{primaryCategory:''}, 
       componentInfo:{componentID:'Product Fast Finder'}};

For more information about integrating with DDX, see IBM Digital Data Exchange integration.

Examples of tag usage

The <cm:element /> tag generates the following IBM Digital Analytics data tag:
cmCreateElementTag(elementID, elementCategory, attributes)

Example 1:

To pass basic data about a customer's interaction with an page element to IBM Digital Analytics:

Include tag in your store page with the following code:
<cm:element elementId="Product Fast Finder" category="Product Tools" />
Example of IBM Digital Analytics data tag generated:
cmCreateElementTag ("Product Fast Finder", "Product Tools")

Example 2:

To pass Explore attributes along with the element tag to IBM Digital Analytics, use the extraparms parameter (first position):

Include tag in your store page with the following code:
<cm:element elementId="Product Fast Finder" category="Product Tools" 
extraparms="attr1-_-attr2-_-attr3"/>
Example of IBM Digital Analytics data tag generated:
cmCreateElementTag ("Product Fast Finder", "Product Tools", 
"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.