Using the product 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:product
/>
tag that WebSphere Commerce provides. The <cm:product
/>
tag generates the following IBM Digital Analytics tag: cmCreateProductviewTag
.
Tag placement in store pages
Include the <cm:product
/>
tag in the product display, item display, bundle display,
and package display JSP pages. In the page, place the <cm:product
/>
tag before the <cm:pageview />
tag.
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:product />
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:product />
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.product=new Array();
digitalData.product[0]={};
digitalData.product[0]={attributes:{exploreAttributes:''},
category:{primaryCategory:'3074457345616676683', virtualCategory:''},
productInfo:{productID:'MCL008_0802', productName:'Albini Dark Gray Wool Suit'}};
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:product
/>
tag generates the following IBM Digital Analytics data
tag:cmCreateProductviewTag(productID, productName, categoryID, attributes, cm_vc)
Example 1:
To pass basic data to IBM Digital Analytics about a product that a customer viewed:
Include tag in your store page with the following code: |
|
Example of IBM Digital Analytics data tag generated: |
|
Example 2:
To pass a
category ID override value to IBM Digital Analytics,
use the extraparms
parameter (first position):
Include tag in your store page with the following code: |
|
Example of IBM Digital Analytics data tag generated: |
|
Example 3:
To pass Explore
attributes to IBM Digital Analytics,
use the extraparms
parameter (second position):
Include tag in your store page with the following code: |
|
Example of IBM Digital Analytics data tag generated: |
|
Example 4:
To pass a
"virtual category" to the IBM Digital Analytics cm_vc
parameter,
use the extraparms
parameter (third position):
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:product
/>
tag generates the following IBM Digital Analytics data
tag:cmCreateProductviewTag(pageId, productID, productName, categoryID, store_id,
pageCount, masterItemCategory, catIDoverride, attributes)
Example 1:
To pass basic data to IBM Digital Analytics about a product a customer viewed:
Include tag in your store page with the following code: |
|
Example of IBM Digital Analyticsdata tag generated: |
|
Example 2:
To pass Explore
attributes to Coremetrics, use the extraparms
parameter
(second position):
extraparms
values.
If your store is not on WebSphere Commerce Version 7 Feature Pack
3 or later, you must specify the values using properly escaped JavaScript: - Simplified syntax example
extraparms="value1-_-value2,value3-_-value4"
- Properly escaped JavaScript example
extraparms="\"value1-_-value2\",\"value3-_-value4\""
If any of your extraparms
values
are JavaScript variables, see the syntax rules explained in Syntax for passing JavaScript variables as extra parameters.
Include tag in your store page with the following code: |
|
Example of IBM Digital Analyticsdata tag generated: |
|
For details about each parameter in the IBM Digital Analytics data tag, see the documentation that is provided by IBM Digital Analytics.