How to aggregate data from events and from their attributes
What is an aggregator?
An aggregator is a module that lets you collect numerical data. You can either count event occurrences or sum up the value of their attributes.
Note: Aggregators can be activated only via automations.
How to use it
First, go to "Tools" -> "Aggregators" and click "Create".
Fill in the fields "Name" and "Description".
Set up the rest according to the descriptions below.
If you select the option, "Calendar", the system will aggregate values for the exact period you specify. So, you basically pich the date right in the calendar.
If you select "Relative", the first number typed will represent the beginning of the period (in days in the past or in the future), and the second the end of the period (in days in the past/future).
- to count the event occurrences 30 days in the past: from -30 to 0
- to count the event occurrences 30 days in the future: from 0 to 30
- to count the event occurrences between 2 weeks ago and 1 week ago: from -14 to -7
The example below shows the count for 30 days in the future.
The total number of event occurrences - The aggregator will return how many times the event occurred (e.g. Count how many purchases each user has made withi last X days).
The total number of event occurrences with a certain attribute - The aggregator will return the number of events of a given name that carries a specified attribute(s).
Sum of certain attributes - The aggregator will return the sum of values of a specified attribute(s) for events of a given name (e.g. Count the value of each user’s purchases in the last X days).
Choose the desired event from the drop-down menu.
If, as the "Aggregation type", you select “Event count”, you can leave the field blank. Otherwise, select the attribute whose value you want to sum up or whose existence you want to check.
For all the users together - The aggregator will return the overall sum for all users in your database; the result of this calculation will be visible in the module, "Dashboards", and on the page of given aggregator.
For each user separately - The aggregator will calculate data for each user.
For each company based on employee events - The aggregator will calculate data for all the people from a given company.
This field will be visible only if you choose “For all the users together” in the previous step.
Type the sum of days you previously set up in the section "Calendar/Relative".
This field will be visible if you choose “For each user separately” or "For each company based on employee events” in the previous step.
Here, you choose the name of the attribute where the aggregation result will be stored.
In the example below, the aggregator will go through your whole database looking for events called “purchase” that carried the attribute “template” and were sent in March 2018.
The result will be the number of how many such events were found.
In the example below, the aggregator will return the number of applications each user created in the last year and will store the number in user attribute called “apps”.
How to activate an aggregator
To make the aggregator work, create an automation.
Go to "Automations" -> "Create".
You can trigger the automation with anything you want and add the module, "Aggregator" at the end. (You can find this module in the section "Actions".)
To see results of your aggregation, go to "Tools > Aggregators" and click on the aggregator you want to check results for.
For given user/For companies which user is assigned to
Results of your aggregation in these two cases are saved as a value of "Custom attribute selected" when creating your "Aggregator".