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

  1. Add the <useCookies> element to your biConfig.xml file:
    1. Open your biConfig.xml file at the following path:
      • WC_eardir/xml/config/bi/biConfig.xml
      • WebSphere Commerce DeveloperWCDE_installdir/workspace/WC/xml/config/bi/biConfig.xml
    2. Locate the <store> element.
    3. Within the <store> element, add the following element:
      <useCookies>true</useCookies>

      The result can look similar to the following example:

      <store storeId="10101" biprovider="coremetrics" enabled="true" 
      debug="true" useHostedCMHLibraries="true" useEmailForCustomerId="false" 
      segmentExportMode="append"> 
      <useCookies>true</useCookies>
      ... 
      ... 
      ... </store>
    4. Save and close the biConfig.xml file.
  2. 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>
      	...
  3. Restart the WebSphere Commerce server.