Storing category information in cookies for analytics reporting
You can configure your site to store category information in cookies to pass to
an analytics provider. The configuration steps involve adding a <useCookies>
element to your biConfig.xml configuration file, and adding a
<cm:setCategoryCookie/>
tag to certain store pages.
In sales
catalogs, often a single product can belong to more than one category. To ensure that your analytics
data associates products to the specific sales category that the shopper browsed, you can store the
category information in cookies. The WebSphere Commerce JSTL tags, such as the
pageview
, cart
, and order
tags, inspect the
cookies to get the category information, which is then passed to the analytics
provider.
Procedure
-
Add the
<useCookies>
element to your biConfig.xml file: -
Ensure that the relevant store pages include the
<cm:setCategoryCookie/>
tag. Complete the steps that apply to your situation:- If your store is based on the Aurora starter store, the relevant store JSP pages are already
pretagged with the
<cm:setCategoryCookie/>
tag. Those following pages are pretagged:- CategoryNavigationDisplay.jsp
- SubCategoryPage.jsp
- TopCategoryPage.jsp
- For other stores, add the
<cm:setCategoryCookie/>
tag to your category display and product display pages. Within each JSP file, place the<cm:setCategoryCookie/>
tag above the<html>
element in the file, as shown in this example for IBM Digital Analytics (see the line that is labeled 1):<!-- BEGIN CategoryNavigationDisplay.jsp --> <%@include file="../Common/EnvironmentSetup.jspf" %> <%@include file="../Common/JSTLEnvironmentSetupExtForRemoteWidgets.jspf" %> <%@include file="../Common/nocache.jspf" %> <%@ taglib uri="http://commerce.ibm.com/coremetrics" prefix="cm" %> ... 1 <cm:setCategoryCookie /> ... <html xmlns:wairole="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#" xmlns:waistate="http://www.w3.org/2005/07/aaa" lang="${shortLocale}" xml:lang="${shortLocale}"> <head> ...
- If your store is based on the Aurora starter store, the relevant store JSP pages are already
pretagged with the
- Restart the WebSphere Commerce server.