Skip to content

Event Aggregation

Rishabh edited this page Apr 7, 2015 · 2 revisions

The group operation is meant to derive multi-level aggregation on events. This is assuming your events have proper fields that lend themselves to the aggregation operation. This operation also accepts filters to narrow down search scope.

Parameters

  • opcode - group (not_null) - Operation code for this analytics
  • table - table_name (not-null) - Table on which analytics will be run
  • filters - Array of filters (Optional) (default - no filters)
  • nesting - Array of fields - Each field defines one level in grouping

The following example shows a group by query that shows distribution of all app load events across OS types and version breakup therein.

Sample Request

{
    "opcode": "group",
    "table": "test",
    "filters": [         
        {
           "field" : "event",
           "operator" : "equals",
           "value" : "APP_LOAD"
        }
    ],
    "nesting": [
        "os",            //Top level: group events by type of device OS
        "version"        //Next level: os version distribution
    ]
}

Sample Response

{
    "opcode": "group",
    "result": {
        "android": {
            "3.2": 2019,
            "4.3": 299430,
            "4.4": 100000032023
        },
        "ios": {
            "6": 12281,
            "7": 23383773637
        }
    }
}