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:
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.
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: |
|
Example of IBM Digital Analytics data tag generated: |
|
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: |
|
Example of IBM Digital Analytics data tag generated: |
|
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: |
|
Example of IBM Digital Analytics data tag generated: |
|
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.
<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: |
|
Example of IBM Digital Analytics data tag generated: |
|
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: |
|
Example of IBM Digital Analytics data tag generated: |
|
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: |
|
Example of IBM Digital Analyticsdata tag generated: |
|
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: |
|
Example of IBM Digital Analytics data tag generated: |
|
For details about each parameter in the IBM Digital Analytics data tag, see the documentation that is provided by IBM Digital Analytics.
Error tag
<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.
<%@ taglib uri="http://commerce.ibm.com/coremetrics" prefix="cm" %>
<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: |
|
Example of IBM Digital Analytics data tag generated: |
|