Using the page view tag with IBM Digital Analytics

If your site is integrated with IBM Digital Analytics, formerly known as Coremetrics Analytics, you can use the default implementation of the <cm:pageview /> tag that WebSphere 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:

Feature Pack 8

Example of tag usage and output for IBM Digital Data Exchange (DDX)

If your WebSphere 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.

Feature Pack 3

Examples of tag usage: for the standard IBM Digital Analytics library

The <cm:pageview /> tag generates the following IBM Digital Analytics data tag:
cmCreatePageviewTag(pageID, categoryID, searchString, searchResults, attributes, extraFields)

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 IBM Digital Analytics data tag generated:
cmCreatePageviewTag(document.title, null, null, null); 

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 IBM Digital Analytics data tag generated:
cmCreatePageviewTag(document.title, "FURNITURE", null, null); 

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 IBM Digital Analytics data tag generated:
cmCreatePageviewTag(document.title, null, "Coffee", "15"); 

Example 4:

To track server or application error pages, you can use the page view tag with descriptive pageID or categoryID parameters in your error display JSP pages.

Note: The <cm:error /> tag is deprecated by IBM Digital Analytics, so do not use it going forward.
Include tag in your store page with the following code:
<cm:pageview category="ERROR"/>
Example of IBM Digital Analytics data tag generated:
cmCreatePageviewTag (document.title, "ERROR", null, null); 

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

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 IBM 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 IBM 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 IBM 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.

Feature Pack 3: Deprecated feature

Error tag

Note: The <cm:error /> tag is deprecated by IBM Digital Analytics. Do not add this tag to any new system error pages. Instead, to pass page view data about a system error page to IBM Digital Analytics, use the <pageview /> tag with descriptive pageID or categoryID parameters (see this example). If your store already uses the <cm:error /> tag, you are not required to remove the tag and replace it with the <pageview /> tag. The following information is retained only to support existing implementations of the <cm:error /> tag.

To pass page view data about a system error page to IBM Digital Analytics, WebSphere Commerce provides an error tag, <cm:error />. The error tag is similar to the page view tag, but it is designed specifically to capture the views of system error pages.

Include the error tag in all system error pages. Do not include a page view tag along with the error tag because the error tag also acts as page view tag. The error tag must be the last tag within the <body> element of any JSP file.

To use the error tag, you must also include the tag library in the JSP file before the main page content. Use the following code to include the tag library:

<%@ taglib uri="http://commerce.ibm.com/coremetrics" prefix="cm" %>
The <cm:error /> tag generates the following IBM Digital Analytics data tag:
cmCreateErrorTag(pageID, categoryID, storeId, attributes)
Include error tag in your store page like the following code:
<cm:error />
Example of IBM Digital Analytics data tag generated:
cmCreateErrorTag(document.title, null, 10101, null)