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


Product tag

The product tag collects information about product 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 the product tag:

ProductBaseTag

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


Parameters

The product tag takes the following parameters:

databean

An optional parameter that is a populated instance of either a ProductDataBean, an ItemDataBean, a BundleDataBean, or a PackageDataBean. If this parameter is missing, one will be created if the catentryId attribute is not empty.

catentryId

The catalog entry ID of the product being displayed. This parameter is ignored if a value is specified using the databean parameter.

extraparms

An optional parameter that communicates additional information to the external analytics service 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, to support dynamic content. Any parameter given in extraparms starting and ending with the $ symbol, for example, $getMethod$, is assumed to be a method name of ProductDataBean, ItemDataBean, BundleDataBean, or PackageDataBean, depending on the type being used. The only restriction on the method name is that it must take no arguments and the object returned must implement the toString() method.


Product view tag for Coremetrics

WebSphere Commerce provides a default implementation of the product tag for Coremetrics.

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 product tag must be included in the JSP before the page view tag.


Examples

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

<cm:product databean="${product}" />


XML definition

<tag>  
<name>product</name>  
<tag-class>com.ibm.commerce.bi.taglib.coremetrics.ProductTag</tag-class>  
<body-content>empty</body-content>  
<description>Sets Product View tag for product display
pages.</description>  
<attribute>    
<name>databean</name>    
<required>false</required>    
<rtexprvalue>true</rtexprvalue>    
<description>Populated instance of 
      com.ibm.commerce.catalog.beans.ProductDataBean, 
      com.ibm.commerce.catalog.beans.ItemDataBean, 
      com.ibm.commerce.catalog.beans.BundleDataBean, or
      com.ibm.commerce.catalog.beans.PackageDatabean. If missing, one will be 
      created if catentryId attribute is not empty.</description>  
</attribute>  
<attribute>    
<name>catentryId</name>    
<required>false</required>    
<rtexprvalue>true</rtexprvalue>    
<description>Catalog entry ID of the product being displayed. Will be ignored if 
    a databean is given.</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. Any information specified as a value for this parameter is 
      appended to the argument list in the Coremetrics tag output and should be properly 
      escaped JavaScript. 

To pass more than one parameter, separate values with a comma like extraparms="\"field1\", \"field2\"". This parameter will also allow the customer to make a function call within the given databean which allows for dynamic content to be supplied. Any parameter given in extraparms starting and ending with the $ symbol, like $getMethod$, will be assumed to be a method name of ProductDataBean, ItemDataBean,BundleDataBean, or PackageDataBean depending on the type being used. The only restriction on the method name is that it must take no arguments and the object returned must implement the toString() method. </description> </attribute> </tag>


Related tasks

Tag the store pages for Coremetrics

Related reference

Page view tag

Order tag

Shop cart tag

Registration tag

Campaign URL tag

Content URL tag

Generic tag


+

Search Tips   |   Advanced Search