Reference > Analytics for IBM WebSphere Commerce > Analytics tag library for IBM WebSphere Commerce


Page view tag

The page view tag collects information about page views and sends the information to an external analytics system.

The data generated by this tag class includes:

WebSphere Commerce provides an abstract base tag implementation class for page view:

CommonBaseTag

This base tag collects information about an analytics page view event. Analytics vendors who want to provide a page view tag in their Web analytics JSP tag library for WebSphere Commerce can extend this base tag class to get the page view data and implement their own logic to generate the vendor-specific page view tagging APIs.


Parameters

The page view tag takes the following parameters:

pagename

An optional parameter that communicates a specific page name to the external analytics system. If no name is provided, the page title is used.

category

An optional parameter that communicates the category ID of the page.

databean

An optional parameter intended for search results pages. The object passed must be a populated instance of the CatEntrySearchListDataBean.

extraparms

An optional parameter that communicates additional information to the external analytics system as necessary. This parameter is provided for cases in which you might have negotiated with the external analytics vendor to generate some custom report that requires additional information. Any information specified as a value for this parameter is appended to the argument list in the analytics tag output and should be properly escaped JavaScript.

To pass more than one parameter, separate values with a comma as shown in this example:

extraparms="\"field1\", \"field2\""

This parameter also allows you to make a function call within the given data bean, which supports dynamic content. Any parameter using extraparms starting and ending with the $ symbol, for example, $getMethod$, will be assumed to be a method name of the CatEntrySearchListDataBean. The only restriction on the method name is that it must take no arguments and the object returned must implement the toString() method.

srchKeyword

An optional parameter that communicates the search keyword used when the page viewed is a search results page.

srchResults

An optional parameter that communicates the number of search results when the page viewed is a search results page.


Page view tag for Coremetrics

WebSphere Commerce provides a default implementation of the page view tag for Coremetrics. The page view tag for Coremetrics must be included in all pages that customers can view. It is not necessary on JSP fragments or other included file assets.

To use this tag, include the tag library in the JSP page. The tag library must be referenced prior to the main page content. Use the following tag so that the JSP page refers to the tag library:

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

The page view tag must be the last tag within the <body> element of any given JSP file.


Examples

In most cases, to add the page view tag, you only need to include the following code:

<cm:pageview />

To add the tag so that it collects search data on a search results page, include the following tag:

<cm:pageview databean="${catEntSearchListBean}" />


XML definition

<tag>   
<name>pageview</name>   
<tag-class>com.ibm.commerce.bi.taglib.coremetrics.CommonTag</tag-class>   
<body-content>empty</body-content>   
<description>Includes the required Coremetrics JavaScript
     libraries and sets the applicable Coremetrics tags. This must be the
     last Coremetrics tag to be called. Otherwise, any other tags used
     afterwards may or may not be ignored. This tag cannot be used on the
     same page as the error tag.
  
</description>   
<attribute>     
<name>pagename</name>     
<required>false</required>     
<rtexprvalue>true</rtexprvalue>     
<description>Name of the page being viewed. If missing, the page
        title will be used.</description>   
</attribute>   
<attribute>     
<name>category</name>     
<required>false</required>     
<rtexprvalue>true</rtexprvalue>     
<description>Category ID of the page being viewed</description>   
</attribute>   
<attribute>     
<name>srchKeyword</name>     
<required>false</required>     
<rtexprvalue>true</rtexprvalue>     
<description>The search keyword to use in case of a search results
        page</description>   
</attribute>   
<attribute>     
<name>srchResults</name>     
<required>false</required>     
<rtexprvalue>true</rtexprvalue>     
<description>The search result count to use in case of a search
        results page</description>   
</attribute>   
<attribute>     
<name>databean</name>     
<required>false</required>     
<rtexprvalue>true</rtexprvalue>     
<description>Populated instance of
        com.ibm.commerce.search.beans.CatEntrySearchListDataBean. If given,         the search parameters of the Coremetrics PageView tag will be filled
        out and is therefore, meant to be used on search result pages.</description>   
</attribute>   
<attribute>     
<name>extraparms</name>     
<required>false</required>     
<rtexprvalue>true</rtexprvalue>     
<description>Additional fields that will be appended to
        argument list in the Coremetrics tag output. 

To pass more than 1 parameter, use an input like extraparms="\"field1\", \"field2\"".</description> </attribute> <attribute> <name>debug</name> <required>false</required> <rtexprvalue>true</rtexprvalue> <description>Whether or not to display output for development and debugging purposes. Acceptable values are "true" or "false". If missing, the global default will be used.</description> </attribute> </tag>


Error tag for Coremetrics

WebSphere Commerce provides an error tag for Coremetrics. The error tag is used to capture the views of system error pages. The error tag should be placed in all system error pages. You do not need to place a page view tag along with the error tag since error tag also acts as page view tag.

To use this tag, include the tag library in the JSP page. The tag library must be referenced prior to the main page content. Use the following tag so that the JSP page refers to the tag library:

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

The error tag must be the last tag within the <body> element of any given JSP file.


Examples

In most cases, to add the error tag, you only need to include the following code:

<cm:error /> 


XML definition

  
<tag>       
<name>error</name>       
<tag-class>com.ibm.commerce.bi.taglib.coremetrics.ErrorTag</tag-class>       
<body-content>empty</body-content>       
<description>Includes the required Coremetrics JavaScript
           libraries and outputs the Coremetrics error tag. This must be the
           last Coremetrics tag to be called and cannot be used on the same page
           as the pageview tag.</description>       
<attribute>           
<name>pagename</name>           
<required>false</required>           
<rtexprvalue>true</rtexprvalue>           
<description>Name of the page being viewed. If missing, the page
               title will be used.</description>       
</attribute>       
<attribute>           
<name>category</name>           
<required>false</required>           
<rtexprvalue>true</rtexprvalue>           
<description>Category ID of the page being viewed</description>       
</attribute>       
<attribute>           
<name>extraparms</name>           
<required>false</required>           
<rtexprvalue>true</rtexprvalue>           
<description>Additional fields that will be appended to
               argument list in the Coremetrics tag output. 

To pass more than 1 parameter, use an input like extraparms="\"field1\", \"field2\"".</description> </attribute> <attribute> <name>debug</name> <required>false</required> <rtexprvalue>true</rtexprvalue> <description>Whether or not to display output for development and debugging purposes. Acceptable values are "true" or "false". If missing, the global default will be used.</description> </attribute> </tag>


Related tasks

Tag the store pages for Coremetrics

Related reference

Order tag

Shop cart tag

Product tag

Registration tag

Campaign URL tag

Content URL tag

Generic tag

Auto tagging utility


+

Search Tips   |   Advanced Search