Writing an aggregator for Active Site Analytics
We can write our own scripts to retrieve the data for Active Site Analytics from the portal themes and skins and connect to the analytics service provider. Such scripts are called aggregators.The portal themes that come with WebSphere Portal write the data that Active Site analytics needs into the markup. The data is provided in the form of microformats, which are injected into the markup during rendering.
The scripts that retrieve this data from the page markup are called aggregators. After retrieving the relevant microformat instances, the aggregator typically submits the collected data to an external analytics service where the data is then recorded, processed, and formatted in the form of reports.
The portal provides a client side JavaScript SPI used to implement aggregators. The SPI is named Active Site Analytics Mediator SPI.
Aggregatorthat are based on the Active Site Analytics Mediator SPI behave consistently in WebSphere Portal, irrespective of the render mode of the portal page to which the aggregator is applied. This includes server side aggregation rendering and client side aggregation rendering modes. An aggregator can capture the latest data that is relevant for Active Site Analytics even in the client side aggregation mode that uses Ajax technologies to refresh individual page parts that are part of the DOM. Beyone that, the SPI also supports custom Ajax applications that can be part of a portal page.
From a programming model perspective, the Active Site Analytics Mediator SPI allows aggregator implementations to register callback functions; the portal framework calls these functions to notify the aggregator about DOM changes that can be relevant for Active Site Analytics. Upon receiving such notifications, aggregators can parse the DOM to find the relevant microformats to send this information to the analytics service.
For typical portal pages use the Active Site Analytics Mediator SPI for implementing the aggregators. However, for simpler pages we can also implement the aggregator using a simple inline script which is executed at the end of the portal page. In this case the page must fulfill both of the following conditions:
- The page does not exploit client side aggregation rendering.
- Your applications on the page do not use Ajax technologies to refresh single page parts that might contain analytics-relevant microformats.
Note that the SPI does not affect the way we can configure aggregators. For details about how to configure aggregators see the topic about Add an Active Site Analytics aggregator to a portal page.
- The Active Site Analytics Mediator SPI
The portal provides a client side JavaScript SPI named Active Site Analytics Mediator SPI. We can use it to implement aggregators. The Active Site Analytics Mediator SPI allows aggregators to register callback functions; the portal framework calls these functions to notify the aggregator about DOM changes that can be relevant for Active Site Analytics.- Guidelines for implementing an aggregator
When you implement an aggregator using the Active Site Analytics Mediator SPI, the following guidelines can be helpful.- Aggregator patterns and samples
This section provides common aggregator patterns and samples that we might want to adopt to implement our own aggregator.- How to identify and resolve problems with the aggregator
If your custom aggregator is not working correctly, perform the checks listed here.
Parent: Collect analytics data