Writing an aggregator for active site analytics
You can write your own scripts to retrieve the data for active site analytics from the portal themes and skins. Such scripts are called aggregators. The portal Tab Menu - Page Builder theme includes two sample aggregators.
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 is shipped with the following sample script files:
- Standard javascript implementation of code that builds URLs with active site analytics parameters: asa_sample.js .
- Implementation that requires dojo to be available in the theme to build URL: asa_sample_dojo.js .
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:
- Verify that the HTML markup of the portal page contains the metadata for which the aggregator is looking.
- Verify the tagging method that is used in the themes, skins, and portlets matches the expected behavior of the aggregator.
For example, the Tab Menu - 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.
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.
Parent topic:
Analyzing user behavior by Active Site Analytics
Related concepts
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
Injecting custom aggregators