(Developer)
Add multiple analytics providers to the biConfig.xml file
Add multiple analytics providers to the store by updating the <biproviders> element in your biConfig.xml configuration file. Indicate the storeId and the analytics provider you would like to use for that store. To save time, we can also indicate a default analytics provider by updating the <defaults> element.
Task info
We can complete this task at the same time we are integrating an external analytics provider, or after the provider is already integrated.When we are updating the biConfig.xml file to define the analytics provider configuration, we can set default values for each configuration setting. By setting default values, we can quickly configure multiple stores to use the same configuration for an analytics provider. We can also override any of the default values for an individual store by including a different value in the configuration for the store. See Configure default values for an analytics provider.
To update your analytics provider configuration, update the biConfig.xml file in your development environment and then deploy your file to the WebSphere Commerce enterprise archive (EAR) on the staging or production environment.
(Developer) When we are updating the biConfig.xml file in your development environment, we can use a reload file to help you quickly test configuration changes. By using this reload file, you do not need to continually restart your server to apply configuration changes from the biConfig.xml file.
Procedure
- Open your existing biConfig.xml configuration file at the following path:
workspace_dir/WC/xml/config/bi/biConfig.xml
- Update your biConfig.xml configuration file to reflect the analytics providers we want to use in the <biproviders> element. See the sample biConfig.xml configuration file in the following example.
- Save your file.
- Optional: We can override the default values for the <output> element to use the configuration for a specific provider. To specify the output section configuration to use for overriding the default values, you need to update the tag configuration in the CommonJSToInclude.jspf file for our store. For example, to update the <cm:output /> tag, locate the following code.
<flow:ifEnabled feature="Analytics"> <%-- The CM header tag must be in the <head> tag of the JSP --%> <cm:output section="header" /> </flow:ifEnabled>Update the tag to identify the analytics provider to use by including the analytics provider name:
<flow:ifEnabled feature="Analytics"> <%-- The CM header tag must be in the <head> tag of the JSP --%> <cm:output section="header" biprovider="analytics_provider" /> </flow:ifEnabled>Where analytics_provider is the name of the analytics provider to use.
Example
The following sample biConfig.xml configuration file has two analytics providers configured: coremetrics and additionalprovider.<?xml version="1.0" encoding="UTF-8"?> <BIConfiguration> 1 <biproviders> 1a <biprovider name = "coremetrics"> <header> <![CDATA[ ]]> </header> <footer> <![CDATA[ ]]> </footer> </biprovider> 1b <biprovider name = "additionalprovider"> <header> <![CDATA[ ]]> </header> <footer> <![CDATA[ ]]> </footer> </biprovider> </biproviders> 2 <defaults> <store storeId = "10101"> <biprovider name = "coremetrics"/> </store> </defaults> 3 <stores> 3a <store storeId = "10101" biprovider = "coremetrics" debug = "false" enabled = "true"> <clientid>12345</clientid> <output section = "header"> <![CDATA[ <script language="JavaScript1.1" type="text/JavaScript" src="/wcsstore/coremetrics/v40/eluminate.js"></script> <script language="JavaScript1.1" type="text/JavaScript" src="/wcsstore/coremetrics/v40/techprops.js"></script> <script language="JavaScript1.1" type="text/JavaScript" src="/wcsstore/coremetrics/cmdatatagutils.js"></script> <script language="JavaScript1.1" type="text/JavaScript"> <!-- //cmSetProduction(); //--> </script> <script language="JavaScript1.1" type="text/JavaScript"> <!-- ]]> </output> <output section = "footer"> <![CDATA[ //--> </script>]]> </output> </store> 3b <store storeId = "10101" biprovider = "additionalprovider" debug = "false" enabled = "true"> <output section = "header"> <![CDATA[ <!-- Beginning of additional analytics provider header code --> <!-- End of additional analytics provider header code --> ]]> </output> <output section = "footer"> <![CDATA[ <!-- Beginning of additional analytics provider footer code --> <!-- End of additional analytics provider footer code --> ]]> </output> </store> </stores> </BIConfiguration>
- 1 The <biproviders> element defines the analytics providers that the store is integrated with. In this example, line 1a defines the first analytics provider as coremetrics and line 1b defines the second analytics provider as additionalprovider.
- 2 The <defaults> element specifies the store, and which one of the analytics providers in the <biproviders> element is going to be the default that the store uses.
- 3 The <stores> element defines details about each of the analytics providers. In this example, there are two <store> elements, which are defined in lines 3a and 3b : one for coremetrics and another for additionalprovider. In each <store> element, we must set these parameters:
- storeId
- The ID of the store that we are integrating with an analytics provider.
- biprovider
- The name of the analytics provider that we are integrating with. This name is the same as the name value specified in the <biprovider> element near the top of the biconfig.xml file.
- enabled
- A flag that controls whether the analytics tags in the store pages are enabled to send data to the analytics provider. We can set the following values for this flag:
- true - Analytics tags are enabled.
- false - Analytics tags are not enabled; analytics data is not sent to the analytics provider.
- debug
- A flag that controls whether debug mode is enabled for the analytics tags. The debug messages display on the web page where the tag is located, generally at the bottom of the page. We can set the following values for this flag:
- true - Debugging is enabled.
- false - Debugging is not enabled.
Next topic: Specifying multiple analytics providers in store page analytics tags