Writing an aggregator for Active Site Analytics
You can write own scripts to retrieve the data for Active Site Analytics from the portal themes and skins. Such scripts are called aggregators. The portal Page Builder theme includes a sample aggregator.
The portal themes and skins come with plugpoints that allow you to inject custom Javascript snippets. These scripts are called aggregators. You can write such an aggregator to retrieve the instances of the microformat in which you are interested. For example, this can be all CSS classes that start with asa. You can extract that data and submit it to the external analytics service where the data are then recorded and processed for evaluation.
The aggregator script is typically a JavaScript file.
The portal Page Builder theme provides a sample script file named asa_sample.js. This is a standard JavaScript implementation of code that builds URLs with Active Site Analytics parameters.
Tips for using the sample aggregator: When you use the sample aggregator file, be aware of the following points:
- You need to update the Javascript variable trackingImg to point to a real HTTP server.
- The tracking image needs to exist and be available. Otherwise the alternative text shows up on the portal page.
Additional tips for writing aggregators:
- To retrieve the relevant information from the DOM tree of the HTML document, the aggregator can iterate over all instances of metadata. Within the iteration loop, the aggregator collects and formats individual data according to the requirements of the external analytics service.
- After all instances of metadata are collected, the aggregator adds a new element to the HTML DOM tree of the current page, for example, an img element. Adding this element with the source URL that points to the external analytics service triggers a browser request from that remote location. As the element URL contains the collected metadata as HTTP GET parameters, the browser submits this data to the external analytics service.
- The sample aggregators contain more detailed information about the process of collecting, formatting and submitting data.
How to identify and resolve problems: If Active Site Analytics is not working correctly, perform the following checks:Aggregators are regular JavaScript files. Therefore all tools and helpers that are applicable to generic JavaScript debugging also apply to developing and debugging an aggregator.
- Verify that the HTML markup of the portal page contains the metadata for which the aggregator is looking.
- Make sure that the tagging method used in the themes, skins, and portlets matches the expected behavior of the aggregator. For example, the Page Builder theme shipped with the portal tags all metadata with CSS classes whose names start with asa. The sample aggregators look for those CSS classes in order to retrieve portlet identifiers and portlet titles.
- To review what occurs in the aggregator inclusion, specify the trace string com.ibm.wps.theme.extensions.ActiveSiteAnalytics=debug .
Parent
Analyzing user behavior by Active Site Analytics
How Active Site Analytics data is represented in the portal
Related tasks
Add an Active Site Analytics aggregator to a portal page
Instrument a theme for Active Site Analytics
Configure an aggregator at runtime
Inject custom aggregators
Aggregator JSP
Submitted by s uhlig on Sep 21, 2010 9:49:42 AM Writing an aggregator for Active Site Analytics: wp7
The default theme in WebSphere Portal uses Dojo, which can also be used in aggregators.