+

Search Tips   |   Advanced Search


Instrument a theme for Active Site Analytics

WebSphere Portal provides the Tab Menu - Page Builder theme that is prepared and suitable for use with Active Site Analytics.

You can also enhance the other portal themes or create your own custom theme to utilize the Active Site Analytics functionality.

In order make Active Site Analytics work in a custom theme, do the following:

  1. Add metadata to the page.

  2. Include an aggregator with the page.

  3. Include microformats of interest, that is related to the statistical data that you want to collect.

For more details about these tasks refer to the following sections.

Adding metadata to the page An aggregator picks up information stored in the DOM (document object model) tree of a page. This information must be present in the HTML source of the page. The recommended approach to add this information to a page is to implement the theme or skin so that they write all the necessary information into the DOM tree of the page. Examples:

  1. You can add the identifier of a portlet to the DOM tree by adding the following line to the Control.jsp of the skin:

    <span class="asa.portlet.id" style="display:none;"><%= myPortletID %></span>
    The aggregator can then fetch the identifiers of all portlets on a page by iterating over all occurrences of "span" elements with a class attribute of "asa.portlet.id".

    This line depends on the definition of myPortletID earlier in the Control.jsp. By default, it is defined by using the following JSP code:

    <portal-skin:portletID var="myPortletID"/> <jsp:useBean id="myPortletID" class="java.lang.String" scope="page"/>

  2. You can add the portlet title to the DOM tree by wrapping the <portal-skin:portletTitle> statement in the Control.jsp with a span element that has a class attribute of "asa.portlet.title":

    <span class="asa.portlet.title"><portal-skin:portletTitle></portal-skin:portletTitle</span>

Include aggregators with the page

The portal ships a default implementation of the theme extension point com.ibm.portal.theme.plugin.ActiveSiteAnalyticsItems. It locates and includes a JavaScript with a name that corresponds to the value specified by the key asa_aggregator given with the page metadata. Add the following code somewhere near the closing body tag ( </body> ) of the Default.jsp file of the theme:

<portal-theme-ext:themeExtension id="com.ibm.portal.theme.plugin.ActiveSiteAnalyticsItems">
   <portal-theme-ext:themeExtensionLoop>
      <portal-theme-ext:themeExtensionItemText />
   </portal-theme-ext:themeExtensionLoop> 
</portal-theme-ext:themeExtension>

This code loops over every implementation of the theme extension point and executes it.

The default implementation shipped with the portal follows the approach outlined above.

Include microformats of interest You might need to modify the skins used by a theme so that all of the microformat information that you want to be captured is present when the page is rendered.

For example, you can add this code to the Control.jsp file of a skin to ensure the portlet ID of all portlets on the page is available for the aggregator script to discover:

<span class="asa.portlet.id" style="display:none;"><%= myPortletID %></span>
In this case the file asa_sample.js looks for elements with the class asa.portlet.id to find the portlet ID of all portlets present on the page. Portlet titles can be rendered by using code similar to this:

<portal-skin:portletTitle />
To capture such portlet titles, you can add an additional span element with a class defined for titles that the analytics JavaScript file will look for:

<span class="asa.portlet.title"><portal-skin:portletTitle /></span>
In this case, asa.portlet.title is recognized as the class for all span elements that encompass the rendered text of the portlet titles.


Parent topic:

Analyzing user behavior by Active Site Analytics


Related concepts


How Active Site Analytics data is represented in the portal


Related tasks


Writing an aggregator for active site analytics
Add an Active Site Analytics aggregator to a portal page
Injecting custom aggregators