Store category information in cookies for analytics reporting

We can configure the site to store category information in cookies to pass to an analytics provider. The configuration steps involve adding a <useCookies> element to the 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 the analytics data associates products to the specific sales category that the shopper browsed, we 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 the biConfig.xml file:

    1. Locate the <store> element.

    2. 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>

    3. 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 the situation:

    • If the store is based on the Aurora starter store, the relevant store JSP pages are already tagged with the <cm:setCategoryCookie/> tag. Those following pages are tagged:

      • CategoryNavigationDisplay.jsp
      • SubCategoryPage.jsp
      • TopCategoryPage.jsp

    • For other stores, add the <cm:setCategoryCookie/> tag to the 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 test servers.


Related concepts
Integrating a store with IBM Digital Analytics for WebSphere Commerce