This topic describes how to use the <groups> element to track portlet usage based on periods of time.
You have the following SOAP message:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <Q:executeResultSetQuery xmlns:Q="http://www.bea.com/analytics/AnalyticsQueryService"> <arg0> <eventName> {http://www.bea.com/analytics/ali}portletUses </eventName> <views> <property>*</property> <aggregate>1</aggregate> </views> </arg0> </Q:executeResultSetQuery> </S:Body> </S:Envelope>
When this SOAP message is sent with our application, a count of every time a portlet has been used on the portal is output to the console.
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <Q:executeResultSetQuery xmlns:Q="http://www.bea.com/analytics/AnalyticsQueryService"> <arg0> <eventName> {http://www.bea.com/analytics/ali}portletUses </eventName> <views> <property>*</property> <aggregate>1</aggregate> </views> <groups> <dimension>portlet</dimension> <property>name</property> </groups> </arg0> </Q:executeResultSetQuery> </S:Body> </S:Envelope>
When this SOAP message is sent with the example application, a list of portlet names, each with a corresponding number representing how many times the portlet was used, is output to the console. In a test environment, it looked like this:
Analytics Query API Results: ---------------------------- 98 Community Metrics 35 FCC News Portlet 150 Other Metrics 219 Portlet Metrics 7 Publisher Administration 18 Publisher Community Directory Portlet 274 Report 427 Summary Metrics
To group results by time, you create a <groups> element with the dimension set to time and a <timeGrouping> element set to the period of time you want grouped. The <timeGrouping> element takes an integer value.
For details on the values used with <timeGrouping>, see The <groups> Element.
For the example you are going to group results by day, or <timeGrouping>3</timeGrouping>, and then create a filter so you only see data for the Summary Metrics portlet.
The SOAP message looks like this:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <Q:executeResultSetQuery xmlns:Q="http://www.bea.com/analytics/AnalyticsQueryService"> <arg0> <eventName> {http://www.bea.com/analytics/ali}portletUses </eventName> <views> <property>*</property> <aggregate>1</aggregate> </views> <groups> <dimension>time</dimension> <property></property> <timeGrouping>3</timeGrouping> </groups> <groups> <dimension>portlet</dimension> <property>name</property> </groups> <filters xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <dimension>portlet</dimension> <property>name</property> <values xsi:type="xs:string" >Summary Metrics</values> <operator>1</operator> </filters> </arg0> </Q:executeResultSetQuery> </S:Body> </S:Envelope>
When this SOAP message is sent with the example application, a list of portlet usage statistics by date is output to the console. In a test environment, it looked like this:
Analytics Query API Results: ---------------------------- 173 Summary Metrics 3/21/08 15 Summary Metrics 3/24/08 35 Summary Metrics 3/27/08 14 Summary Metrics 3/28/08 8 Summary Metrics 3/31/08 93 Summary Metrics 4/1/08 89 Summary Metrics 4/2/08 24 Summary Metrics 4/4/08