A Calculated Attribute (CA) is a read-only value about a single user, providing granular insight into user behavior. These attributes are defined in mParticle and are computed automatically over time by using the raw data stream of events and user information.
Calculated Attributes:
Calculated attributes can be defined to track almost anything on an individual user. A calculated attribute is composed of the following elements:
draft
status indicating that they are no being calculated. Once activated, calculated attributes are in the active
status to indicate that they are being calculated and can be used across the mParticle platform and downstream.Calculated attributes are defined and calculated in the scope of a single workspace, which means they use data available within that workspace only. You may create calculated attributes with the same name in multiple workspaces.
Once a calculated attribute is activated, the initialization of existing data can take anywhere from 24 hours to several days, depending on the date range selected and the amount of data to be processed.
We currently support 13 calculations organized into four groups:
Calculate the count
of times an event has occurred. For example:
Calculate statistics about event attributes: sum
, minimum
, maximum
, average
, most frequent
and unique values count
.
For example:
In the event of a tie, most frequent
will pick the last value sorted alphabetically.
Calculate the timestamp or an event value of the first or last observation of a matching event: first value
, first timestamp
, last value
and last timestamp
.
For example:
Calculate the unique list
of values for a specific event attribute:
For example:
The following table defines the data types produced by each calculation. All timestamp values are in ISO 8601 format in the UTC timezone. Several calculations produce results with types that depend on the type of the event attribute selected, for example First Value
will return a string if the event attribute selected is a string.
Group | Calculation Type | Format | Example | Speed |
---|---|---|---|---|
Count | Count | Numeric | 123 |
Instant |
Aggregation | Sum | Numeric | 123.123 |
Instant |
Aggregation | Minimum | Numeric | 123.123 |
Instant |
Aggregation | Maximum | Numeric | 123.123 |
Instant |
Aggregation | Average | Numeric | 123.123 |
Delayed |
Aggregation | Most frequent | Dynamic | romance |
Delayed |
Aggregation | Unique Values Count | Numeric | 34 |
Delayed |
Occurrence | First value | Dynamic | comedy |
Delayed (until observed) |
Occurrence | Last value | Dynamic | action |
Instant |
Occurrence | First timestamp | Timestamp | 2020-01-01T22:14:47.1051728Z |
Delayed (until observed) |
Occurrence | Last timestamp | Timestamp | 2020-01-10T22:14:47.1051728Z |
Instant |
List | Unique List | Comma separated list of dynamic values; maximum of 100. | "Item 1","Item 2","Item 3" |
Instant |
All calculation speeds here are after the values have been initialized. Setting the date range to ‘within the last’ will cause all calculations to update with delayed speed.
Calculations are either instant or delayed. Instant calculations are evaluated immediately and updated values are included in the same outgoing event batch with no delay.
Delayed calculations are evaluated with a small delay (usually a few minutes) and updated values are included in the next outgoing event batch and to outputs connected to a special feed input named “Calculated Attributes” more about this input.
Calculated attributes can be setup to calculate over defined date range. This allows you to limit calculations to a more relevant business window such as “unique list of product purchased in the last 30 days” or “total bookings made over the last year”.
The following date ranges are supported:
To create a Calculated Attribute:
Click on the data criteria section to define the data used to run the calculation.
To adjust date range for your calculation, click on Date Range criteria.
Some calculated attributes, like sum
, require numeric event attributes to function. If you select an attribute that is not detected as the correct type, the platform will warn you about using those fields in the calculated attribute definition. You can still calculate the calculated attribute despite the warning and it will attempt to convert the string values into numerics. For example, if you pass the attribute amount
in as a numeric string like "34.32"
, a sum
calculation will still work correctly.
Seeding allows you to pass in historic values for calculated attributes that mParticle will build upon as new data arrives, without passing in all the raw events. This allows you to seamlessly transition from your own calculations to mParticle’s. You can seed calculated attributes in both draft (recommended) and active states; the calculated attribute must exist before seeding it.
Seeding requires two pieces of information:
After seeds have been sent to mParticle, any of the following changes will make the previously received seeds invalid and subsequently deleted from mParticle.
A calculated attribute must first be activated in order for mParticle to start calculating its values across your users.
To activate a Calculated Attribute:
When activated, mParticle will start to compute and initialize the initial value for the calculated attribute. This uses both the historical data in mParticle and real-time incoming data.
Depending on the date range, volume of data in your workspace, and complexity of definition, calculations will have varying SLAs before it first becomes available across your customer profiles. Whilst calculating, the UI will display its calculation progress.
mParticle will enrich incoming batches with active calculated attributes for that user. Just like regular user attributes, you can restrict which outputs receive them, using data filters.
There is a special feed named ‘Calculated Attributes’ that allows you to send calculated attributes downstream whenever they change, without an event from the user; this feed is especially useful for keeping calculated attributes with delayed calculations synchronized throughout your stack and for sending calculated attributes downstream alongside kit integrations. This input will appear once you have activated a calculated attribute. When a new connection is made to this input, CA values for users who have not been seen since their delayed CAs were calculated will be sent. This feed sends changed calculated attributes, it does not send user attributes.
You can control which downstream system receives these updates by connecting platforms to receive the delayed calculation updates. You can also filter out calculated attributes you do not wish to forward using the platform filters page.
Calculated attributes can be viewed alongside other user attributes in the Live Stream, User Activity view and are accessible via the Profile API.
Calculated attributes can be used in the Audience builder by selecting User > Calculated Attributes. They will show up as ‘string’ types at first and will automatically switch to the correct type as they are computed across many users. You can build audience criteria with a calculated attribute that is calculating and when the attribute values are completed for each user, their audience membership will be updated.
Was this page helpful?