Skip to main content
Gainsight Inc.

Tutorial - Aggregate Usage Data with Bionic Rules

Introduction

In this tutorial, we’ll use Bionic Rules in order to query for usage data related to page views and then pivot the data to aggregate it either by week or by month. This will be accomplished by creating a Dataset Task that queries the usage data within the MDA, and then creating a separate Dataset Task that pivots the data and completes the aggregation.

Following are the goals we intend to achieve using a single rule:

  1. Create Dataset to Fetch Data from MDA.

  2. Create Dataset to Pivot on Pages data.

Fetch Data from MDA

  1. In this step, Navigate to Administration > Rules Engine and create a Rule that enables you to fetch data from MDA.

+RULE.gif

Create Rule

  1. Enter following details in the Create Rule page:
  • Rule For: Select Account.
  • Rule Name: Enter an appropriate name.
  • Folder: Select a folder for the rule.
  • Description: Enter description (optional).
  • Click NEXTSetup Rule page appears.

clipboard_ee040d8268041f15ab6243242012e8239.png

Setup Rule

  1. In the Setup Rule, click DATASET TASK in order to begin creating the tasks the rules will need to complete.

+DATASET TASK.png

  1. Set a Task Name and an Output Dataset Name for your Dataset Task. The Task Name will be used to identify the task within the rule, while the Output. 

    Dataset Name will be used to identify the resulting dataset after the task is completed. Gainsight recommends adding a Task Description with more details about the dataset.

    In our example, this task will fetch data from the MDA and then pivot on the Page Name; so we have named the task, its description, and its output dataset name, accordingly.
  2. Click SAVE.

Task Name.png

  1. Since the goal of this rule is to fetch data from the MDA, select the object that you previously uploaded your Usage Data into.
  2. Add the fields that you would like to reference as part of the pivot and the aggregation and add them to the Show section. In our example, we’ve selected the example object Usage Data. In the Show section we’ve added the fields Company and Company Name (in order to tie this data back to those records). We’ve also added Date, Page Name, and Views as those will be necessary fields for the Pivot and Aggregation.

Show_Me section.png

Note: While not necessary to complete this tutorial, each Dataset Task also has a section for exporting the resulting data to the S3. For more information on the options presented, click here. Select the exporting option that works best for your team.

  1. Click SAVE in the top-right to save the task.

Pivot on Pages Data

  1. Go back to the Setup Rule and click +TASK in order to add a new Dataset Task and Select Pivot to complete pivot and aggregate the usage data.

+Task + Pivot.png

  1. Enter the Task Name, Task Description, and Output Dataset Name for this task. Since we will be using this task to pivot on page data and aggregate by date, we named our example accordingly.

Pivot on Page.png

  1. Under Dataset, select Fetch from MDA in order to pull in the data fetched by our previous task. Also add the fields Date Field and Company into the Show section, as we will need to reference that data within the task.

Configure_pivot_show_sectio.png

  1. Drag the Page Name field and drop it under the Pivot On section. The Pivot conditions to evaluate window is displayed.

Pivot on Page Name.gif

  1. Configure the conditions as shown below:
    1. Values of the Page Name
    2. Use the Output Field Label column to determine how the pivoted data will be identified,
    3. Aggregation column to determine how the data will be aggregated.
    4. Field column to determine what data will be selected as part of the pivot.
    5. Default Value column to determine value of data that is fetched, but does not meet the pivot condition. Set this to 0, to avoid views from other pages to throw off our aggregations.
  1. In the following example, various aggregation methods are used on three pages: 
    Click +ADD to add additional rows.

Pivot Conditions.png

  1. Click OK to set the conditions.

  2. In the GroupBy section, add Date Field and Company Name to ensure the aggregation successfully groups the data by time for each company. When you drag the Date field to Group By section, Company Name field automatically changes to Count of Company , in the Show section. You must change this aggregation and then drag and drop the Company Name field to GroupBy section.

Group by Date field and Company Name.gif

  1. Click the gear icon on the Date Field in order to select how frequently you would like the aggregation to be grouped by. For weekly aggregation, select First Day of Current Week or Last Day of Current Week. For monthly aggregation, select First Day of Current Month or Last Day of Current Month.

Summarizing Date field_1.png

  1. Click SAVE.

These actions aggregate page views successfully for each company either weekly or monthly. You can then setup any action on this data in the Setup Action page. For more information on how to set rule actions, refer Setup Rule Action Types.

  • Was this article helpful?