Using the page view tag with IBM Digital Analytics

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

Tag placement in store pages

Include the <cm:pageview /> tag in all pages that customers can view. This tag is not necessary on JSP fragments or other included file assets. The page view tag must be the last tag within the <body> element of any JSP file.

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:pageview /> 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:pageview /> 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.page={attributes:{exploreAttributes:'', extraFields:''}, category:{primaryCategory:''},
  pageInfo:{onsiteSearchResults:'', onsiteSearchTerm:'', pageID:document.title}};
digitalData.pageInstanceID='wcs-standardpage';

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:pageview /> tag generates the following IBM Digital Analytics data tag:
cmCreatePageviewTag(pageID, categoryID, searchString, searchResults, storeId, attributes)

Example 1:

To pass the basic page view data to IBM Digital Analytics:

Include tag in your store page with the following code:
<cm:pageview />  
Example of Digital Analytics data tag generated:
cmCreatePageviewTag(document.title, null, null, null, 10101); 

Example 2:

To pass the basic page view data with the page category details to IBM Digital Analytics:

Include tag in your store page with the following code:
<cm:pageview  category="FURNITURE"/> 
Example of Digital Analyticsdata tag generated:
cmCreatePageviewTag(document.title, "FURNITURE", null, null, 10101);  

Example 3:

On a search results page, to send search data to IBM Digital Analytics:

Include tag in your store page with the following code:
  • If your store uses the com.ibm.commerce.search.beans.CatEntrySearchListDataBean, use the databean parameter:
    
    <cm:pageview databean="${catEntSearchListBean}" />
    
  • If your store does not use the CatEntrySearchListDataBean, or you do not get an instance of the CatEntrySearchListDataBean in your search results page, use the srchKeyword and srchResults parameters:
    
    <cm:pageview srchKeyword="${srchKeyword}" srchResults="${srchResults}"/>
Example of Digital Analytics data tag generated:
cmCreatePageviewTag(document.title, null, "Coffee", "15", 10101); 

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