Adds web traffic reporting and analytics to an organisation, logging every HTTP request and exposing the resulting data through saved queries, dashboards and report pages. Every response is queued and written to the access log by a background daemon thread, then indexed by the WebHitAppIndexer so it can be searched and aggregated. Registers the Reporting and Queries admin menu items, a "Visits" tab on the profile page, and a set of KEditor components (date histogram, pie chart, query table, date range picker, org selector and others) that templates use to render report data. Also registers the ReportRunnerRole, ReportingAccessRole and ReportsManagerRole permissions that gate access to reporting artifacts. Its query and org-browsing methods (getQueries, getQuery, runQuery, numUsers, searchOrgs, browseUserOrgs and others) are called directly from report page templates.

Implements: MenuApplication, EventListener, LifecycleApplication, ChildPageApplication, AttachmentApplication, SearchableApplication, SettingsApplication, ComponentApplication, TemplatingApplication, ManageProfileApplication, DependentApplication


Properties

PropertyReturnsDescription
geoIPGeoIpWrapperShared MaxMind GeoIP2 lookup wrapper used to resolve a request's IP address to a geographic location for logging and reporting.
groupsList<Group>Groups belonging to the current organisation, used by report components that let a user filter or count members by group.
instanceIdStringKey this application instance is registered under in the application manager, always the fixed string "Reporting".
legacyboolean
queriesList<QueryBean>All saved queries available to the current organisation, used to populate report and dashboard components that pull data from a named query.
queryTablesIterable<Table>All saved query tables available to the current organisation, the underlying data tables that saved queries are built on top of.
rolesList<Role>Roles this application registers: ReportRunnerRole, ReportingAccessRole and ReportsManagerRole, which together gate viewing, filtering and managing reporting artifacts.
userAgentUserAgentParserWrapperShared user agent string parser used to derive browser, OS and device details from a request's User-Agent header when logging or reporting on traffic.
webHitAppIndexerWebHitAppIndexerSearch indexer that stores and queries the web-hit access log entries recorded by this application, used by other apps that need to look up page view or web traffic data.

Methods

getInstanceId() · log(RootFolder rf, Request request, Response response, long duration) · log(RootFolder rf, Request request, Response response, long duration, String path, String referrerUrl, String contentType) · log(RootFolder rf, Request request, Response response, long duration, String path, String referrerUrl, String contentType, String trackingId) · getWebHitAppIndexer() · getRoles() · getUserAgent() · getGeoIP() · getQueries() · getQueryTables() · getQuery(String name) · runQuery(QueryBean queryBean) · runQuery(QueryBean queryBean, Integer from, Integer size) · getQueryFieldNames(QueryBean queryBean) · getGroups() · numUsers(String groupName) · searchOrgs(String q) · listUserOrgs(Long parentId, List<Long> availableOrgs, int size) · listUserOrgs(int size, OrgData parent, boolean recursive, String groupNames) · browseUserOrgs(int size, Long parentId, boolean recursive, String groupNames)

getInstanceId()

Returns: String

Key this application instance is registered under in the application manager, always the fixed string "Reporting".

log(RootFolder rf, Request request, Response response, long duration)

Returns: String

Records this request/response pair as an access log entry, deriving the request path and referrer from the request itself. The entry is queued for asynchronous insertion and indexing rather than written immediately.

ParameterDescription
rfthe root folder the request was served from
requestthe request that was served
responsethe response that was returned
durationhow long the request took to serve, in milliseconds

log(RootFolder rf, Request request, Response response, long duration, String path, String referrerUrl, String contentType)

Returns: String

Records this request/response pair as an access log entry with an explicit path, referrer and content type, for callers that already know the response content type. The entry is queued for asynchronous insertion and indexing rather than written immediately.

ParameterDescription
rfthe root folder the request was served from
requestthe request that was served
responsethe response that was returned
durationhow long the request took to serve, in milliseconds
paththe request path, with any query string already removed
referrerUrlthe referrer URL, with any query string already removed, may be null
contentTypethe response content type

log(RootFolder rf, Request request, Response response, long duration, String path, String referrerUrl, String contentType, String trackingId)

Returns: String

Records this request/response pair as an access log entry with an explicit path, referrer, content type and tracking id, for callers that already have a tracking id for the visitor (e.g. from a tracking cookie). The entry is queued for asynchronous insertion and indexing rather than written immediately.

ParameterDescription
rfthe root folder the request was served from
requestthe request that was served
responsethe response that was returned
durationhow long the request took to serve, in milliseconds
paththe request path, with any query string already removed
referrerUrlthe referrer URL, with any query string already removed, may be null
contentTypethe response content type
trackingIdthe visitor's tracking id, or null if not yet known

getWebHitAppIndexer()

Returns: WebHitAppIndexer

Search indexer that stores and queries the web-hit access log entries recorded by this application, used by other apps that need to look up page view or web traffic data.

getRoles()

Returns: List<Role>

Roles this application registers: ReportRunnerRole, ReportingAccessRole and ReportsManagerRole, which together gate viewing, filtering and managing reporting artifacts.

getUserAgent()

Returns: UserAgentParserWrapper

Shared user agent string parser used to derive browser, OS and device details from a request's User-Agent header when logging or reporting on traffic.

getGeoIP()

Returns: GeoIpWrapper

Shared MaxMind GeoIP2 lookup wrapper used to resolve a request's IP address to a geographic location for logging and reporting.

getQueries()

Returns: List<QueryBean>

All saved queries available to the current organisation, used to populate report and dashboard components that pull data from a named query.

getQueryTables()

Returns: Iterable<Table>

All saved query tables available to the current organisation, the underlying data tables that saved queries are built on top of.

getQuery(String name)

Returns: QueryBean

Looks up one saved query by its source file name.

ParameterDescription
namethe query's source file name, matched exactly

runQuery(QueryBean queryBean)

Returns: KSearchResponse

Executes a saved query against the search index using the default paging (all matching results), with query parameters taken from the current request.

ParameterDescription
queryBeanthe saved query to execute

runQuery(QueryBean queryBean, Integer from, Integer size)

Returns: KSearchResponse

Executes a saved query against the search index with explicit paging, with query parameters taken from the current request. This is an expensive call, as it performs a live search index query.

ParameterDescription
queryBeanthe saved query to execute
fromthe offset of the first result to return, or null for the default offset
sizethe maximum number of results to return, or null for the default page size

getQueryFieldNames(QueryBean queryBean)

Returns: List<String>

Names of the fields returned by a saved query, used to build column headers for a query table component.

ParameterDescription
queryBeanthe saved query to inspect

getGroups()

Returns: List<Group>

Groups belonging to the current organisation, used by report components that let a user filter or count members by group.

numUsers(String groupName)

Returns: Long

Counts the members of a named group in the current organisation, used by the numUsers report component.

ParameterDescription
groupNamethe name of the group to count, looked up within the current organisation

searchOrgs(String q)

Returns: List<OrgDatum>

Searches the organisations available to the current user by name or id prefix, for use in an org-picker component. This is an expensive call, as it performs a live search index query.

ParameterDescription
qthe search text; may contain several terms, each matched as a prefix against the org id and title

listUserOrgs(Long parentId, List<Long> availableOrgs, int size)

Returns: KSearchResponse

Searches the org index for the direct or top-level children of an organisation, restricted to a set of available org ids. This is an expensive call, as it performs a live search index query.

ParameterDescription
parentIdthe parent org id to list children of, or null to list top-level available orgs
availableOrgsthe org ids the current user is allowed to see
sizethe maximum number of results to return

listUserOrgs(int size, OrgData parent, boolean recursive, String groupNames)

Returns: List<OrgBean>

Lists the organisations the current user can browse under a given parent, optionally recursing into selected child orgs. This is an expensive call, as it performs a live search index query.

ParameterDescription
sizethe maximum number of results to return at each level
parentthe parent organisation to list children of, or null to list top-level available orgs
recursiveif true, also fetch children of any org that is itself selected
groupNamesnames of groups to further restrict the available orgs to, or none for no restriction

browseUserOrgs(int size, Long parentId, boolean recursive, String groupNames)

Returns: List<OrgBean>

Lists the organisations the current user can browse under a given parent id, optionally recursing into selected child orgs, restricted to a set of group names. This is an expensive call, as it performs a live search index query. This is the implementation behind listUserOrgs(int, OrgData, boolean, String...).

ParameterDescription
sizethe maximum number of results to return at each level
parentIdthe parent org id to list children of, or null to list top-level available orgs
recursiveif true, also fetch children of any org that is itself selected
groupNamesnames of groups to further restrict the available orgs to, or none for no restriction
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.