Using the shopping cart 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:cart
/>
tag that WebSphere Commerce provides. The <cm:cart
/>
tag generates the following IBM Digital Analytics tag: cmCreateShopAction5Tag
.
Tag placement in store pages
Include the <cm:cart
/>
tag in the shopping cart page. In the page, place the <cm:cart
/>
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:cart />
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:cart />
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.cart.item[0] = {
productInfo:{productID: 'MCL008_0802', productName: 'Albini Dark Gray Wool Suit'},
quantity: '1', price: '977.97', currency: 'USD',
category:{primaryCategory: '3074457345616676683', virtualCategory: ''},
attributes:{exploreAttributes: '', extraFields: ''}};
cmSetupOther({"cm_currencyCode":"USD"});
{}
digitalData.cart.item[1] = {
productInfo:{productID: 'CAC024_2401', productName: 'Widescreen LCD Monitor'},
quantity: '1', price: '132.03', currency: 'USD',
category:{primaryCategory: '3074457345616676695', virtualCategory: ''},
attributes:{exploreAttributes: '', extraFields: ''}};
cmSetupOther({"cm_currencyCode":"USD"});
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:cart
/>
tag generates the following IBM Digital Analytics data
tag:cmCreateShopAction5Tag(productID, productName, productQuantity, productPrice,
categoryID, attributes, extraFields)
Example 1:
To pass basic data to IBM Digital Analytics about each item in a customer's shopping cart:
Include tag in your store page like the following code: | If your store uses data beans and URL commands
for order runtime functions, use the databean parameter:
If your store uses web services for order runtime functions,
use the
|
Example of IBM Digital Analytics data tag generated: |
|
Example 2:
To pass IBM Digital Analytics Explore
attributes to the IBM Digital Analytics cmCreateShopAction5Tag
that
are the same for all items in the shopping cart, use the extraparms
parameter
(position 2):
Include tag in your store page like the following code: | If your store uses data beans and URL commands
for order runtime functions, use the following parameters:
If your store uses web services for order runtime functions, use the following parameters:
|
Example of IBM Digital Analytics data tags 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:cart
/>
tag generates the following IBM Digital Analytics data
tag:cmCreateShopAction5Tag(productId, productName, productQuantity, productPrice,
categoryId, store_id, currency, masterItemCategory, catIDoverride, attributes)
Example 1:
To pass basic data to IBM Digital Analytics about each item in a customer's shopping cart:
Include tag in your store page like the following code: | If your store uses data beans and URL commands
for order runtime functions, use the databean parameter:
If your store uses web services for order runtime functions,
use the
|
Example of IBM Digital Analytics data tag generated: |
|
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.
Example 2:
To pass IBM Digital Analytics Explore
attributes to the IBM Digital Analytics cmCreateShopAction5Tag
that
are the same for all items in the shopping cart, use the extraparms
parameter
(position 2):
Include tag in your store page like the following code: | If your store uses data beans and URL commands
for order runtime functions, use the following parameters:
If your store uses web services for order runtime functions, use the following parameters:
|
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.