Use the page view tag with IBM Digital Analytics
If the site is integrated with IBM Digital Analytics, we 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.
We must also include the tag library in the JSP file before the main page content 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 the 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 the 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.
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, formerly known as Coremetrics 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 Analytics, formerly known as Coremetrics Analytics
data 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 the store uses the CatEntrySearchListDataBean, use the databean parameter:
<cm:pageview databean="${catEntSearchListBean}" />
If the store does not use the CatEntrySearchListDataBean, or you do not get an instance of the CatEntrySearchListDataBean in our search results page, use the srchKeyword and srchResults parameters: <cm:pageview srchKeyword="${srchKeyword}" srchResults="${srchResults}"/>
Example of IBM Digital Analytics, formerly known as Coremetrics 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.
Related concepts
Passing extra data to IBM Digital Analytics with the extraparms parameter
IBM Digital Analytics JavaScript library types: standard and custom
IBM Digital Analytics, formerly known as Coremetrics Analytics integration with Web 2.0 starter stores
Related reference
Page view tag