Skip to main content

Blocks

NetSpring offers a collection of analytic building blocks that can be applied in various scenarios to compute dynamic properties. By combining individual analytic blocks, or blocks for short, you can create intricate computations. For instance, you can use these blocks to define a "derived column" or specify an "inline cohort" within a "retention exploration".

Blocks

Block Editor

The Block Editor enables you to define blocks based on computed properties. The Block Editor's power lies in its comprehensive collection of pre-built blocks and their adaptability to be combined in various ways to fulfill a wide range of analytic needs.

There are certain exploration templates and interfaces in NetSpring that uses blocks to extend their analytic interface. The appearance of the Block Editor in these places may vary slightly, but the underlying blocks library and their functionality remain the same.

In Derived Columns, Cohorts, Metrics

Derived Columns, Cohorts, and Metrics are examples of Catalog entities that represent computed properties. The definition of each of these entities is created within NetSpring using the Block Editor. Initiating the workflow to create any of these entities will bring the user to the Block Editor interface, as shown here.

Block Editor

In Exploration Templates

Exploration templates in NetSpring allow the user to derive computed properties within the template. The user does not necessarily need to define and persist a computed property into the catalog first, such as a derived column, cohort, or metric, before they can use it inside the template. Instead, they can define the computed property from within the context of the template, use it, and persist it along with the template's definition.

Within the exploration template UI, the Block Editor can be accessed in a few different ways.

  • Inline Segments: Within the Segment By Cohort section, click + and then click New Cohort. This will add a new Behavioral Cohort block.
Block Editor
  • Computed Properties: Blocks can also be used to define computed properties to be used for filtering or as first-class attributes, for example, for segmentation. The Block Editor UI is available to the left in the exploration template and can be expanded or collapsed. Within the Block Editor UI, all the blocks used by that exploration template are available, and these blocks can have dependencies on other blocks within the same template. They may not have dependencies on blocks inside other exploration templates since such blocks are not first-class catalog entities.
Block Editor

Block Editor Actions

The Block Editor supports the following actions:

ActionDescription
Add BlockTo add a block in the Block Editor, click either the + or Add Block button. Once clicked, select the desired block type to include it in the definition.
Add Block
DeleteUtilize the more menu (represented by a vertical ellipsis) located in the upper-right corner of the designated block and select the Delete option.
Delete Block
DuplicateTo duplicate a specific block, use the more menu (vertical ellipsis) located in the top-right corner of the block, and select Duplicate. This action will generate a new block directly below the source block.
Duplicate Block
Rename a blockWe suggest renaming your blocks to reflect the associated business logic. By default, the Block Editor generates a name for each new block, and this name can vary.
Rename Block
ValidateNetSpring automatically validates your block definitions and highlights any blocks that contain errors. Errors are indicated either by an error message or by the block being displayed in red.
Validate Block
Output designationIn the Block Editor, a toggle called Output may appear in the top-right corner of a block. This toggle is activated for at least one block and designates the block that represents the overall output of the computation. This functionality is limited to the use of the Block Editor in Derived Columns, Cohorts, and Metrics.
Output Block

Block Library

Regardless of the method used to access the Block Editor, a comprehensive library of diverse blocks is available. These blocks are intended to be combined effectively to perform complex computations. This section enumerates all block categories and their corresponding inputs.

Aggregate Block

An Aggregate block calculates a summary of a property or block. The calculation involves applying an aggregation function to the input property and potentially organizing its results into groups.

Aggregate
Example

Use an Aggregate Block to calculate the "Total Spend per User" by combining transaction amounts for each user.

Here are the available fields to configure the block:

FieldDescription
AggregatorFunction used to aggregate input for a block.
- avg: Computes the average of the values in the input provided.
- count: Counts the total number of values in the input provided, including duplicates.
- unique count: Counts the number of unique values in the input provided.
- first: Computes the first value in the input provided. The first value is determined by ordering all inputs by event time.
- last: Computes the last value in the input provided. The last value is determined by ordering all inputs by event time.
- max: Computes the maximum value in the input provided.
- min: Computes the minimum value in the input provided.
- sum: Sums all the values in the input provided.
InputAggregator block input. It can be a property, a block, value, or a parameter.
Group byUse this optional configuration to group the output of the aggregator block by the specified set of attributes. Each attribute can be either a property or a block.
Output

The result of the aggregate block is a numerical value that may include a grouping attribute if the configuration uses the Group by option.

Alias Block

Use an Alias block to assign a local name to a provided input. The input is typically a catalog entity, such as a dataset or property, but it can also be a block, value, or parameter.

Alias
Example

You can use the Alias block to assign the name "Revenue" to a dataset column with the longer and cryptic name "TRAILING_12_MONTHS_REVENUE". After that, you can use the shorter name assigned through the Alias block inside a Formula block to calculate the "Profit" property as Revenue - Cost.

Here are the available fields to configure the block:

FieldDescription
InputThe property that will be given an alias. It can be an existing property of a dataset, such as a column or derived column, or it can be a block, a value, or a parameter.
Output

The output of the Alias block is identical to the input property that is used.

And/Or Block

An And/Or block type is utilized to specify conditions that yield a Boolean value, specifically true or false. This block type can be formed by merging multiple conditions or sets of conditions using And or Or operators, which accounts for its nomenclature.

And/Or
Example

The And/Or block can be utilized to calculate a cohort of "High-Value Users" whose "Total Spend per User" exceeds a specified threshold and whose profile has the "Paid Subscription" property set to true.

Here are the available fields to configure the block:

FieldDescription
OperatorsComparison operators used in each condition are as follows. Note that when working with string data, comparison semantics are case-insensitive.

- is: The left-hand side of the condition equals the right-hand side of the condition.
- is not: The left-hand side of the condition does not equal the right-hand side of the condition.
- contains: The left-hand side of the condition is a string that contains the right-hand side of the condition as a substring.
- in: The left-hand side of the condition is present within the set of values selected on the right-hand side of the condition.
- < > >=...: mathematical operators.

Properties used for comparison may include catalog properties such as columns, derived columns, blocks, values, or parameters.
Output

The output of the And/Or Block is a boolean value.

Behavioral Cohort Block

A behavioral cohort block is utilized to choose a subset of a dataset, which is based on the observed behavior and/or other properties of the dataset's records. The behavior of a dataset's record is determined by the events that are linked with the entity.

Behavioral Cohort
Example

The Behavioral Cohort block can be utilized to establish a group of users who arrived at the app through a social media campaign, subsequently registered for a no-cost account, and advanced to a paid account to access premium features within one week. Behavioral Cohorts can embody intricate sequences, including the one described above, and additional ones. The Behavioral Cohort block extensively accommodates the following categories of criteria:

  • Filter.
  • Single Behavior.
  • Sequence.
  • Group.

Here are the available fields to configure the block:

FieldDescription
Filter or Property FilterThis definition filters dataset records by their property values. The left-hand side of the filter can reference a dataset property, such as a column or derived column, another block, or a parameter. Similarly, the right-hand side can reference any of these or a constant value.

Comparison operators used in each condition are as follows. Note that when working with string data, comparison semantics are case-insensitive.

- is: The left-hand side of the condition equals the right-hand side of the condition.
- is not: The left-hand side of the condition does not equal the right-hand side of the condition.
- contains: The left-hand side of the condition is a string that contains the right-hand side of the condition as a substring.
- in: The left-hand side of the condition is present within the set of values selected on the right-hand side of the condition.
- < > >=...: mathematical operators.

Properties used for comparison may include catalog properties such as columns, derived columns, blocks, values, or parameters.
Add Single BehaviorApply a filter to the dataset to extract records associated with specific events. Use a Condition to define the criteria for filtering, and an Aggregate filter to select events that meet the specified criteria.

Condition Section Definition: The Condition section enables users to select dataset records based on the presence or absence of a specific event. For instance, users can choose to filter records for those who performed or did not perform a checkout event. This section comprises the following filters:
- Event Selector: Used to select specific events or broad event categories, such as an event stream.
- Event Filter: Used to narrow down to a specific set of events.
- Time Filter: Provides a rich interface to filter events based on their occurrence time. This filter has three modes:
      1. Relative - Time is relative to the current time, for example, the last three months or all time.
      2. Absolute - The time window is based on absolute dates and, optionally, time of day.
      3. Relative to Event - Filters events based on the duration between an event and a baseline event or timestamp specified here. For example, within two weeks after the first occurrence of the "onboarding" event.

Definition of Aggregate Filter (Where): This section describes how to limit the dataset records selection to only those where the aggregate of all matching events meets a specific condition. The aggregation process applies to the designated property of all matching events. To combine multiple aggregate filters, use the AND operator.
SequenceA sequence selects a dataset record if they have matching events in the specified order and meeting any associated filter criteria. Each stage of the sequence is defined by an event selection, an optional filter, and a time filter.
- Event Selector: This is used for selecting specific events or broad event categories (as an event stream).
- Event Filter: This can be used for filtering down to a specific set of events.
- Time Filter: This is a rich interface for filtering events based on the time of occurrence of each event. This filter can be used in the following modes:
     1. Relative - relative to current time, e.g. last 3 months, or all time
     2. Absolute - time window based on absolute dates and optionally time of day.
     3. Relative to Event - filters events based on relative duration between an event and a baseline event or timestamp indiciated here. In the case of a sequence, the baseline event may also refer to a previous stage, e.g. within 2 weeks after previous stage.
GroupAny composition of above criteria or other groups.
Output

The output of the Behavioral Cohort block is a boolean value.

Bin Block

A Bin block is utilized to assign a property to distinct "bins" or labels, depending on the range within which the value of the property falls.

Bin
Example

The bin block can categorize a continuous measure, such as "Last Year Sales per User", into various tiers based on different ranges, such as "Silver Tier" for values between $0 and $100, "Gold Tier" for values between $100 and $1000, and "Platinum Tier" for higher values.

The Bin block has two main configurations: assigning input values to bins and defining bins.

FieldDescription
Input ValueUse this input value to calculate the bins output by the Bin Block. This may refer to a catalog property, block, or parameter.
BinsHere, you can add the configuration for individual bins, which can be added or removed as needed. The block attempts to match input values with the set of bins defined in this section, in the order they appear. In the event that a single value is mapped redundantly to multiple bins, the block will use the first matching bin.

Each bin is defined as follows:
- Label or Bin: This is the name to use for the bin.
- Start: Minimum value that falls within the bin (inclusive).
- End: Maximum value that falls within the bin (exclusive).
In addition, an Out of range label may also be provided for data that does not fall inside any of these bins.
Output

The output of the Bin block is a string value.

Filter Block

A Filter block is used to select a specific property from input data by filtering it.

Filter
Example

The Filter block can be used to extract all records in a Page Views dataset where Platform equals iOS. Extract the Error Count column from each record to output. Then, use an Aggregate block to compute the total errors on iOS with the output.

Here are the available fields to configure the block:

FieldDescription
Data ValueThe property being filtered and output by this block, which can be a dataset property (such as a column, derived column, and so on) or another block.
Filter byReferring to the data defined above, this is the filter condition. It can comprise one or more conditions, which can be organized into a hierarchical structure of nested and/or conditions with unlimited levels.

Comparison operators used in each condition are as follows. Note that when working with string data, comparison semantics are case-insensitive.

- is: The left-hand side of the condition equals the right-hand side of the condition.
- is not: The left-hand side of the condition does not equal the right-hand side of the condition.
- contains: The left-hand side of the condition is a string that contains the right-hand side of the condition as a substring.
- in: The left-hand side of the condition is present within the set of values selected on the right-hand side of the condition.
- < > >=...: mathematical operators.

Properties used for comparison may include catalog properties such as columns, derived columns, blocks, values, or parameters.
Output

This block can be used to compute a property derived from the data by the Filter block. This property may take the form of a column or another block.

Formula Block

A Formula Block is used to enter computations that use NetSpring's formula language, also known as NetScript. For detailed documentation on syntax and functions, refer to the NetScript language reference.

Formula
Example

This block type can be used to define arithmetic formulas, such as Profit = Sales - Cost.

Output

The output of this block is not fixed and depends on the formula definition.

If/Then/Else Block

The If/Then/Else Block is utilized to establish a sequence of "If/Else/Then" provisions to generate a property relying on a range of diverse criteria. When given an input record, the first matched If provision will generate the output. In case none of the If provisions satisfy the conditions for a given input record, and an Else value is specified, then it will be utilized. If no Else value is specified, then the output will be null.

If/Then
Example

If/Then/Else block can be used to define a matching "Logical Event" as follows:

If Events.Type = 'ViewPage' and Events.Page = 'Home'
Then 'Home Page View'
If Events.Type = 'ViewPage' and Events.Page = 'Search'
Then 'Search Page'
If Events.Type = 'User Profile' and Events.Action = 'Like'
Then 'Liked User'
Else 'Other'

The If/Then/Else block is comprised of a sequence of If/Then definitions, with at least one required, followed by an optional Else block.

To incorporate an If/Then condition, select + Add Condition. Moreover, to replicate an If Condition, select the more menu (vertical ellipsis) situated at the top right of the If Condition.

Here are the available fields to configure the block:

FieldDescription
If ConditionThe If condition acts as a filter on source data, which may include properties of a dataset, such as a column or a derived column, or a block. The filter condition can be specified by one or more conditions, which can be grouped into a hierarchy of nested and/or conditions, with arbitrary depth.

Comparison operators used in each condition are as follows. Note that when working with string data, comparison semantics are case-insensitive.

- is: The left-hand side of the condition equals the right-hand side of the condition.
- is not: The left-hand side of the condition does not equal the right-hand side of the condition.
- contains: The left-hand side of the condition is a string that contains the right-hand side of the condition as a substring.
- in: The left-hand side of the condition is present within the set of values selected on the right-hand side of the condition.
- < > >=...: mathematical operators.

Properties used for comparison may include catalog properties such as columns, derived columns, blocks, values, or parameters.
ThenThe output value for data that matches the corresponding If Condition is assigned by the Then value. This value may consist of a constant value, a dataset column or derived column property, another block, or parameter.
ElseIf none of the If conditions match the source data, the default value to output is the Else value. This value can be a constant value, a property like a dataset column or derived column, another block, or a parameter.
Output

The output of an If/Then/Else block is determined by the results of the Then and Else portions specified within the If/Then/Else definition.

Intervals Engaged Block

The Engaged Intervals Block is a block that calculates the number of time intervals, such as days or weeks, during which a user or other actor interacted with a product or service. This block is useful for measuring user engagement with a product, feature, new release, experiment, and so on.

Intervals Engaged
Example

To monitor user engagement for a mobile app, the Intervals Engaged block may be utilized in conjunction with the And/Or block. This allows for the identification of users who have used the app on at least 10 distinct days within 4 to 8 weeks after installing it. This particular group of users is likely to have integrated the app into their regular routine and is progressing towards habitual use.

Here are the available fields to configure the block:

FieldDescription
Count of distinct Time IntervalsThe count of unique days, weeks, or months, etc. to determine user engagement.
ActorThis Actor dataset pertains to the entity that performed an action or demonstrated engagement, as indicated by the when clause.
Event or Action (did)To demonstrate engagement, pinpoint the particular activity of interest. Consider specifying "active" or "user-initiated" events instead of "passive" events like push notifications.
To filter the selection of events, use the complete event filtering interface outlined below:

- Event Selector: This is used for selecting specific events or broad event categories (as an event stream).

- Event Filter: This can be used for filtering down to a specific set of events.
Comparison operators used in each condition are as follows. Note that when working with string data, comparison semantics are case-insensitive.

- is: The left-hand side of the condition equals the right-hand side of the condition.
- is not: The left-hand side of the condition does not equal the right-hand side of the condition.
- contains: The left-hand side of the condition is a string that contains the right-hand side of the condition as a substring.
- in: The left-hand side of the condition is present within the set of values selected on the right-hand side of the condition.
- < > >=...: mathematical operators.

Properties used for comparison may include catalog properties such as columns, derived columns, blocks, values, or parameters.

- Time Filter: This is a rich interface for filtering events based on the time of occurrence of each event. This filter can be used in the following modes:
1. Relative - relative to current time, e.g. last 3 months, or all time
2. Absolute - time window based on absolute dates and optionally time of day.
3. Relative to Event - filters events based on relative duration between an event and a baseline event or timestamp specified here, e.g. "within 2 weeks after event "onboarding" first occurrence".
FrequencyThis is specified using the at least and at most settings. This puts a constraint on the number of times the actor should have engaged in the activity identified above.
Output

The output of the Intervals Engaged Block is a numeric value for each Actor used within the Intervals Engaged block definition.

Moving Aggregation Block

The Moving Aggregation Block calculates a measurement across a sliding or cumulative window of time. There are two different types of aggregation that can be performed withing this block - Regular and Hopping. While regular aggregation applies a secondary aggregation over pre-aggregated data (like a window function in SQL), hopping aggregation directly aggregates raw data (there is no analog in SQL). Regular does not change the dimensionality of the input, while hopping does.

Regular Aggregation

Regular aggregation applies a secondary aggregation to the results of an existing aggregation over a specified time window. For example, you can first calculate daily event counts (a regular aggregate) and then apply a trailing 7-day sum to these counts using a regular moving aggregation. Following is an example to demonstrate Regular Aggregation.

Let's create a metric that calculates the sum of the total ad revenue for the current day and the preceding 6 days.

  • Create a new metric and add a Moving Aggregation block.
  • Select sum as the aggregator and Total Ad Revenue as the value in the Input section.
  • Under Configuration, select Regular as the aggregation type and then configure the Rolling window - set the points before value to 6. and the points after value to 0.
  • Set the time granularity to Daily and run the visualization.
Filter

Hopping Aggregation

Hopping aggregation computes metrics directly over a rolling time window without re-aggregating. For instance, if you have daily event counts, a hopping aggregation applies a 7-day trailing window that "hops" by one day at a time to calculate the same result. This method is essential for operations like rolling averages or distinct counts, which cannot be achieved with regular aggregation. Let's create an example metric to demonstrate a hopping aggregation.

  • Create a new metric and add a Moving Aggregation block.
  • Select unique count as the aggregator and user_id as the value in the Input section.
  • Under Configuration, select Hopping as the moving aggregation type. Choose the Trailing option under the Window Type dropdown.
  • Configure the trailing window to cover the desired duration - in our example, 7 days.
  • Set the time granularity to Daily and run the visualization.
Moving Aggregation

Here are the available fields to configure the block:

FieldDescription
Metric SelectorFollowing options are supported:
- Cumulative: Aggregate the metric in an expanding time window.
- Rolling: Aggregate the metric over a sliding time window.
AggregatorFunction used to aggregate input for a block.
- avg: Computes the average of the values in the input provided.
- count: Counts the total number of values in the input provided, including duplicates.
- unique count: Counts the number of unique values in the input provided.
- first: Computes the first value in the input provided. The first value is determined by ordering all inputs by event time.
- last: Computes the last value in the input provided. The last value is determined by ordering all inputs by event time.
- max: Computes the maximum value in the input provided.
- min: Computes the minimum value in the input provided.
- sum: Sums all the values in the input provided.
Input ValueChoose the input value used to calculate the moving aggregation. This may be a property of the dataset, such as a column or derived column, or it may be another block.
Time WindowThe time window setting will vary depending on the metric selected above in the metric selector.
- Cumulative: For this metric, the time window is a time range over which to compute the cumulative measure.
- Rolling: For this metric, a number of time points before and time points after can be provided.
Output

The output of this block is a numerical measure.

Period vs Previous Period Block

The Period versus Previous Period Block compares a metric between the current period and a preceding period.

Period vs Previous Period
Example

Compute monthly change in revenue as a percentage.

Here are the available fields to configure the block:

FieldDescription
MeasureSelect the measure for comparison. This can be a dataset property such as a column, a derived column, etc., or a block.
Comparison Type (Using)Dropdown of multiple comparison types:
- Absolute Change: Absolute delta between current and previous value.
- Percent Change: Change since previous period, expressed as a percent of the previous value.
- Percent of Previous Value: Current value, expressed as a percent of the previous value.
Periods AgoThe number of periods in the past to use as baseline.
Filter byThis can be utilized to filter to a specific set of records before conducting a comparison between the period and the previous period.

Comparison operators used in each condition are as follows. Note that when working with string data, comparison semantics are case-insensitive.

- is: The left-hand side of the condition equals the right-hand side of the condition.
- is not: The left-hand side of the condition does not equal the right-hand side of the condition.
- contains: The left-hand side of the condition is a string that contains the right-hand side of the condition as a substring.
- in: The left-hand side of the condition is present within the set of values selected on the right-hand side of the condition.
- < > >=...: mathematical operators.

Properties used for comparison may include catalog properties such as columns, derived columns, blocks, values, or parameters.
For EachThis can be used to traverse through the elements in the dataset and choose attributes to make the process more specific.
Filter byThis section can be used to add additional filters.
Output

The output of this block is a metric that shows the comparison result or difference between the current periods.

Previous/Next Value Lookup

The Previous Value Lookup block retrieves the prior value of a time-ordered property, which can be an event stream or block, for an actor such as a user.

Previous/Next Value Lookup
Example

For a mobile app product analytics use case, use this block to capture the date of the last activity for each user. Combine it with another block to calculate the gap since the last activity.

Here are the available fields to configure the block:

FieldDescription
Previous/NextSelect previous or next value for the time ordered property per actor.
Time seriesSelect a time ordered block or an event stream property as an input.
FilterThis can be used for filtering down to a specific set of records before applying the previous/next selector.

Comparison operators used in each condition are as follows. Note that when working with string data, comparison semantics are case-insensitive.

- is: The left-hand side of the condition equals the right-hand side of the condition.
- is not: The left-hand side of the condition does not equal the right-hand side of the condition.
- contains: The left-hand side of the condition is a string that contains the right-hand side of the condition as a substring.
- in: The left-hand side of the condition is present within the set of values selected on the right-hand side of the condition.
- < > >=...: mathematical operators.

Properties used for comparison may include catalog properties such as columns, derived columns, blocks, values, or parameters.
Output Specific PropertyThis field enables you to choose the particular property from the preceding or subsequent matching record that should be produced as output.
Only emit a value when there is a changeWhen this option is selected, this block will produce a value that is not null only if the preceding or subsequent value differs from the current value for the same property.
For EachThis can be used to traverse through the elements in the dataset and choose attributes to make the process more specific.
Output

The output of this block is the type of the previous value property.

Property Block

Use the Property Block to select a specific property of a dataset or block.

Property
Example

Select the Platform property from AppEvents dataset.

Here are the available fields to configure the block:

FieldDescription
PropertyColumn or derived column.
Dataset or BlockSelect an existing dataset or any other block defined within this same context.
Output

The output of this block is the same as the selected property.

Rank Block

A Rank Block is used for ranking properties in a dataset based on a measure.

Rank
Example

You can utilize the Rank block to allocate rankings to each product based on their revenue over the past three months using the Moving Aggregation block. Apply the Filter block to the Rank block's output to identify the top five products.

Here are the available fields to configure the block:

FieldDescription
Rank ofThe property values that are being ranked.
Rank byOne or more ordering properties for ordering in ascending (ASC) or descending order (DESC).
Output

The output produced by this block is a metric that indicates the overall position of the selected property value.