Transaction Attributes Extended table¶
The Transaction Attributes Extended table contains additional attributes for customer flags, customer orders, data differences, time period rollups, and RFM scores, many of which are represented by duration (days, months, years, lifetime), order position (first, second, last), frequency, and revenue.
Extended transaction attributes—customer flags, customer orders, date differences, time period rollups, and RFM—are also calculated by Amperity based on data sources that contain interaction records that were tagged with transactions and itemized transaction semantics.
Important
Database tables for transactions must be configured in the following order:
Transaction Attributes Extended (this topic)
The Unified Product Catalog table is optional and may be configured for use with building queries, database tables, and other non-audience workflows. Your brand’s product catalog must be integrated into the Unified Itemized Transactions table before you can use product catalog attributes to build audiences, segments, and campaigns.
Add table¶
The Transaction Attributes Extended table is a required table for the customer 360 database and is added using a SQL template.
To add the Transaction Attributes Extended table
Open your customer 360 database in edit mode, and then click Add Table.
Name the table “Transaction_Attributes_Extended” (with underscores).
Set the build mode to SQL, and then select “Transaction Attributes Extended” from the Apply template drop-down.
Review the list of optional attributes to determine if any of those should be enabled for your tenant.
Click Next to validate the SQL.
Select “Transaction Attributes Extended” from the Table Semantics drop-down, and then add a description for the table. (The description is available as a tooltip in other locations in Amperity.
Click Save.
Optional attributes¶
You can extend the set of attributes that are available from the Transaction Attributes Extended table to include any of the following:
Note
These attributes are built into the SQL templates for the Transaction Attributes Extended table, but are commented out. Some sets of attributes require updates be made to both tables, while others may only require updates be made to one table. The steps for each set will link to a topic section that descibes the updates that should be made to the Unified Transactions table.
Cancellations¶
You can extend the Unified Itemized Transactions table to show intervals for the frequency at which orders were canceled, the amount of revenue that was canceled, and the total number of items that were canceled.
To add extended attributes for canceled items
Open the Transaction Attributes Extended table in the SQL editor.
Uncomment the augmented_cancellations block of SQL.
Uncomment the can_attrs block of SQL.
Find the SELECT statement at the end of the SQL template, and then uncomment the following sets of calculated intervals:
Order Canceled Frequency include 30 days, 3 months, 6 months, 12 months, 12-24 months, and lifetime.
Order canceled Revenue include 30 days, 3 months, 6 months, 12 months, 12-24 months, and lifetime.
Total canceled Items include 30 days, 3 months, 6 months, 12 months, 12-24 months, and lifetime.
Note
These attributes are not grouped together within the SELECT statement.
Uncomment the LEFT JOIN at the end of the SELECT statement:
LEFT JOIN can_attrs ON attrs.amperity_id = can_attrs.amperity_id
Validate the SQL, and then click Next, and then click Save.
Net order revenue¶
Net order revenue is the revenue for all items in an order, including returned and canceled items, but not including discounted amounts.
To add extended attributes for net order revenue
Required. Add Net Order Revenue to the Unified Transactions table.
Open the Transaction Attributes Extended table in the SQL editor.
Find the section named “attrs”, which contains a series of commented-out extended attributes for net order revenue.
Uncomment one (or more) of the following extended attributes:
,FIRST(txn.first_order.net_order_revenue IGNORE NULLS) AS first_net_order_revenue ,FIRST(txn.second_order.net_order_revenue IGNORE NULLS) AS second_net_order_revenue ,FIRST(txn.latest_order.net_order_revenue IGNORE NULLS) AS latest_net_order_revenue ,MAX(IF(txn.net_order_revenue > 0, txn.net_order_revenue, NULL)) AS lifetime_largest_net_order_value ,SUM(txn.net_order_revenue) AS lifetime_net_order_revenue ,SUM(IF(txn.ly12m, txn.net_order_revenue, 0)) AS LY12M_net_order_revenue ,SUM(IF(txn.l12m, txn.net_order_revenue, 0)) AS L12M_net_order_revenue ,SUM(IF(txn.l30d, txn.net_order_revenue, 0)) AS L30D_net_order_revenue ,SUM(IF(txn.l3m, txn.net_order_revenue, 0)) AS L3M_net_order_revenue ,SUM(IF(txn.l6m, txn.net_order_revenue, 0)) AS L6M_net_order_revenue
Note
These attributes are grouped together within the “attrs” section.
Find the SELECT statement at the end of the SQL template, and then uncomment the following sets of calculated intervals:
Average Net Item Price include 30 days, 3 months, 6 months, 12 months, 12-24 months, and lifetime.
Largest Net Order Value includes lifetime.
Net Order Revenue include first, latest, and second orders along with 12-24 months and lifetime.
Net Order Value include 30 days, 3 months, 6 months, 12 months, 12-24 months, and lifetime.
Note
These attributes are not grouped together within the SELECT statement.
Validate the SQL, and then click Next.
Click Save.
Order costs¶
Order cost represents the total cost of goods sold (COGS) for a single transaction, minus returns, cancellations, and discounts.
To add extended attributes for order cost
Open the Transaction Attributes Extended table in the SQL editor.
Find the section named “attrs”, which contains a series of commented-out extended attributes for order costs.
Uncomment one (or more) of the following extended attributes:
,FIRST(txn.first_order.order_cost IGNORE NULLS) AS first_order_cost ,FIRST(txn.latest_order.order_cost IGNORE NULLS) AS latest_order_cost ,FIRST(txn.second_order.order_cost IGNORE NULLS) AS second_order_cost ,SUM(IF(txn.l30d, txn.order_cost, 0)) AS L30D_order_cost ,SUM(IF(txn.l3m, txn.order_cost, 0)) AS L3M_order_cost ,SUM(IF(txn.l6m, txn.order_cost, 0)) AS L6M_order_cost ,SUM(IF(txn.l12m, txn.order_cost, 0)) AS L12M_order_cost ,SUM(IF(txn.ly12m, txn.order_cost, 0)) AS LY12M_order_cost ,SUM(txn.order_cost) AS lifetime_order_cost
Note
These attributes are grouped together within the “attrs” section.
Find the SELECT statement at the end of the SQL template, and then for each of the attributes enabled within “attrs”, uncomment the line to add the extended attribute to the Transaction Attributes Extended table:
,CAST(attrs.first_order_cost AS decimal(38,2)) AS first_order_cost ,CAST(attrs.latest_order_cost AS decimal(38,2)) AS latest_order_cost ,CAST(attrs.second_order_cost AS decimal(38,2)) AS second_order_cost ,CAST(attrs.L30d_order_cost AS decimal(38,2)) ,CAST(attrs.l3m_order_cost AS decimal(38,2)) ,CAST(attrs.l6m_order_cost AS decimal(38,2)) ,CAST(attrs.l12m_order_cost AS decimal(38,2)) ,CAST(attrs.ly12m_order_cost AS decimal(38,2)) ,CAST(attrs.lifetime_order_cost AS decimal(38,2))
Note
These attributes are not grouped together within the SELECT statement.
Validate the SQL, and then click Next.
Click Save.
Returns¶
You can extend the Unified Itemized Transactions table to show intervals for the frequency at which orders were returned, the amount of revenue that was returned, and the total number of items that were returned.
To add extended attributes for returned items
Open the Transaction Attributes Extended table in the SQL editor.
Uncomment the augmented_returns block of SQL.
Uncomment the ret_attrs block of SQL.
Find the SELECT statement at the end of the SQL template, and then uncomment the following sets of calculated intervals:
Order Returned Frequency include 30 days, 3 months, 6 months, 12 months, 12-24 months, and lifetime.
Order Returned Revenue include 30 days, 3 months, 6 months, 12 months, 12-24 months, and lifetime.
Total Returned Items include 30 days, 3 months, 6 months, 12 months, 12-24 months, and lifetime.
Note
These attributes are not grouped together within the SELECT statement.
Uncomment the LEFT JOIN at the end of the SELECT statement:
LEFT JOIN ret_attrs ON attrs.amperity_id = ret_attrs.amperity_id
Validate the SQL, and then click Next, and then click Save.
RFM¶
RFM is a method used to analyze customer value that represents three dimensions:
Recency. How recently did the customer purchase?
Frequency. How often does the customer purchase?
Monetary. How much does the customer spend?
A score for recency, frequency, and monetary is assigned on a scale of 1-10, and is then aggregated into a combined RFM score that is assigned on a scale of “111” (the lowest possible RFM score) to “101010” (the highest possible RFM score, or “three ‘10’ scores”). Maximum scores represent preferred behaviors.
To add extended attributes for RFM
Open the Transaction Attributes Extended table in the SQL editor.
Uncomment the l12m_rfm block of SQL. This section uses the NTILE() function to calculate recency, frequency, and monetary scores as deciles.
In the attrs block of SQL, uncomment the calculations for RFM attributes:
,FIRST(rfm.recency) AS L12M_recency ,FIRST(rfm.frequency) AS L12M_frequency ,FIRST(rfm.monetary) AS L12M_monetary ,FIRST(rfm.score) AS L12M_rfm_score
and then uncomment the LEFT JOIN in the same section:
LEFT JOIN l12m_rfm rfm ON txn.amperity_id = rfm.amperity_id
Find the SELECT statement at the end of the SQL template, and then uncomment the following extended attributes:
,attrs.L12M_rfm_score ,attrs.L12M_recency ,attrs.L12M_frequency ,attrs.L12M_monetary
Validate the SQL, and then click Next, and then click Save.
Column reference¶
Extended transaction attributes are presented as a single table (with many columns), including an Amperity ID, and fit into the following categories:
Customer flags¶
Each record has a set of flags that indicate if a customer has purchased, the number of brand interactions, the number of brand channels, and if that customer is an early repeat purchaser.
Column Name |
Data type |
PII |
Description |
---|---|---|---|
Amperity ID |
String |
An Amperity ID is a patented unique identifier that is assigned to clusters of customer records. A single Amperity ID represents a single individual. Unlike other systems, the Amperity ID is reassessed every day for the most comprehensive view of your customers. |
|
Early Repeat Purchaser |
Boolean |
Early repeat purchaser is a flag that indicates if a customer made a repeat purchase within the previous 90 days. Tip Use the Early Repeat Purchaser attribute as a leading indicator for overall conversion rate of one-time buyers to repeat customers, even when it does not capture the total number of one-time buyers who have returned to purchase again. Also in: Transaction Attributes |
|
Multi Purchase Brand |
Boolean |
A flag that indicates if a customer has interacted with more than one brand. This column is calculated from the Purchase Brand column in the Unified Transactions table, which is created when the purchase-brand semantic tag is applied to interaction records that contain transactions data. Also in: Transaction Attributes |
|
Multi Purchase Channel |
Boolean |
Multi-purchase channel is a flag that indicates if a customer has purchased from more than one channel. This column is calculated from the Purchase Channel column in the Unified Transactions table, which is created when the purchase-channel semantic tag is applied to interaction records that contain transactions data. Also in: Transaction Attributes |
|
One And Done |
Boolean |
One and done is a flag that indicates if a customer has made only one purchase. Important Amperity uses the range of data that is provided to it to identify one-time buyers. For example, if Amperity is provided data for the years 2015-2022, purchases made in 2014 are not used to identify one-time buyers. Also in: Transaction Attributes |
Customer orders¶
Each record contains a subset of order data from a customers first, second, and latest order. Each set of attributes is prefixed by first, second, or latest, depending on the order data that is being summarized.
Column Name |
Data type |
PII |
Description |
---|---|---|---|
<X> Order Datetime |
Datetime |
The datetime on which the order was made. Available columns:
Also in: Transaction Attributes |
|
<X> Order ID |
String |
The ID of the order. Available columns:
Also in: Transaction Attributes |
|
<X> Order Purchase Brand |
String |
The brand of the order made by the customer. Available columns:
Also in: Transaction Attributes |
|
<X> Order Purchase Channel |
String |
The channel in which the customer’s order was made. Available columns:
Also in: Transaction Attributes |
|
<X> Order Revenue |
Decimal |
The total revenue for orders at each interval. Available columns:
Also in: Transaction Attributes |
|
<X> Store ID |
String |
The ID of the store where the customer made their order. This value may be
|
|
<X> Total Items |
Integer |
The total number of items in the order. Available columns:
Also in: Transaction Attributes |
Date differences¶
Each record contains three attributes that specify the number of days between certain events.
Column Name |
Data type |
PII |
Description |
---|---|---|---|
Days Since Latest Order |
Integer |
Days since latest order measures the number of days that have elapsed since a customer has placed an order. This column is calculated from the Latest Order Datetime column in the Transaction Attributes table. |
|
First To Latest Order Days |
Integer |
First-to-latest order days is the number of days that have elapsed between the date of the first order and the date of the latest order. This column is calculated from the First Order Datetime and Latest Order Datetime columns in the Transaction Attributes table. |
|
First To Second Order Days |
Integer |
First-to-second order days is the number of days that have elapsed between the date of the first order and the date of the second order. This column is calculated from the First Order Datetime and Second Order Datetime columns in the Transaction Attributes table. |
Time period rollups¶
Each record contains time period rollups of the customer’s transaction history. The time periods used are lifetime, L12M (the 12 months of transaction history starting 12 months ago), LY12M (the 12 months of transaction history starting 24 months ago), and L30D (the last 30 days).
Column Name |
Data type |
PII |
Description |
---|---|---|---|
<X> Average Item Price |
Decimal |
The average item price during the time period. Available columns:
|
|
<X> Average Net Item Price |
Decimal |
The average net item price during the time period, minus returns, cancellations, and discounts. Available columns:
Note These attributes must be enabled in the SQL template for the Transaction Attributes Extended table. |
|
<x> Average Num Items |
Decimal |
The average number of items during the time period. Available columns:
|
|
<X> Average Order Value |
Decimal |
The average order value during the time period. Available columns:
|
|
<X> Largest Net Order Value |
Decimal |
The total value for the largest orders in the time period, minus returns, cancellations, and discounts. Available columns:
Note These attributes must be enabled in the SQL template for the Transaction Attributes Extended table. |
|
<X> Net Order Revenue |
Decimal |
The net order revenue for orders in the time period, minus returns, cancellations, and discounts. Available columns:
Note These attributes must be enabled in the SQL template for the Transaction Attributes Extended table. |
|
<X> Net Order Value |
Decimal |
The total value for orders in the time period, minus returns, cancellations, and discounts. Available columns:
Note These attributes must be enabled in the SQL template for the Transaction Attributes Extended table. |
|
<X> Order Cost |
Datetime |
The cost for an order during the time period. Available columns:
|
|
<X> Order Frequency |
Integer |
The count of distinct order IDs that are associated with the customer during the time period. Available columns:
|
|
<X> Order Canceled Frequency |
Integer |
The count of distinct order IDs that are associated with canceled items during the time period. Available columns:
Note These attributes must be enabled in the SQL template for the Transaction Attributes Extended table. |
|
<X> Order Returned Frequency |
Integer |
The count of distinct order IDs that are associated with returned items during the time period. Available columns:
Note These attributes must be enabled in the SQL template for the Transaction Attributes Extended table. |
|
<X> Order Revenue |
Decimal |
The total revenue for orders in the time period. Available columns:
|
|
<X> Order canceled Revenue |
Decimal |
The total revenue for canceled items in the time period. Available columns:
Note These attributes must be enabled in the SQL template for the Transaction Attributes Extended table. |
|
<X> Order Returned Revenue |
Decimal |
The total revenue for returned items in the time period. Available columns:
Note These attributes must be enabled in the SQL template for the Transaction Attributes Extended table. |
|
<X> Preferred Purchase Brand |
String |
The brand with the greatest number of orders during the time period. Available columns:
|
|
<X> Preferred Purchase Channel |
String |
The channel with the greatest number of orders during the time period. Available columns:
|
|
<X> Preferred Store ID |
String |
The store ID with the greatest number of orders during the time period. Available columns:
|
|
<X> Purchase Brands |
Integer |
The count of the distinct brands a customer interacted with during the time period. Available columns:
|
|
<X> Purchase Channels |
Integer |
The count of the distinct channels (online, in store, etc.) that the customer interacted with during during the time period. Available columns:
|
|
<X> Stores |
Integer |
The count of the distinct stores that the customer interacted with during the time period. Available columns:
|
|
<X> Total Items |
Integer |
The total number of items purchased by the customer during the time period. Available columns:
|
|
<X> Total canceled Items |
Integer |
The total number of items canceled by the customer during the time period. Available columns:
Note These attributes must be enabled in the SQL template for the Transaction Attributes Extended table. |
|
<X> Total Returned Items |
Integer |
The total number of items returned by the customer during the time period. Available columns:
Note These attributes must be enabled in the SQL template for the Transaction Attributes Extended table. |
RFM¶
Amperity calculates RFM scores against transactions that occurred within the last 12 months.
Each of the recency (R), frequency (F), and monetary (M) scores are represented by a number between 0 and 9. The final RFM score is a concatenation of the individual scores: recency first, then frequency, monetary last. The final RFM score is a number between 0 and 999.
Column Name |
Data type |
PII |
Description |
---|---|---|---|
L12M RFM Score |
Integer |
The RFM score for the customer is based on transactions that occurred within the last 12 months. The RFM score is represented as an integer between “111” and “101010”. This is a concatenated score that uses each of the individual recency, frequency, and monetary scores. The order is recency, then frequency, and then monetary. For example, you can build an audience that contains your top 20% customers for recency, your top 30% customers for frequency, and your top 10% customers for monetary by setting the L12M RFM Score attribute to “9810” (or “9” for recency, “8” for frequency, and then “10” for monetary). |
|
L12M Recency |
Integer |
L12M Recency is a score that sorts customers by how recently they purchased during the previous 12 months. Each RFM score is split into ten percentile groups. The lowest percentile is 1 and the highest percentile is 10. Each percentile represents 10% of the customers who belong to that segment.
Tip Combine percentiles to build larger groups of customers. For example 9 and 10 together represent the “top 20%” while 8, 9, and 10 represent the “top 30%”. |
|
L12M Frequency |
Integer |
L12M Frequency is a score that sorts customers by purchase frequency during the previous 12 months. Each RFM score is split into ten percentile groups. The lowest percentile is 1 and the highest percentile is 10. Each percentile represents 10% of the customers who belong to that segment.
Tip Combine percentiles to build larger groups of customers. For example 9 and 10 together represent the “top 20%” while 8, 9, and 10 represent the “top 30%”. |
|
L12M Monetary |
Integer |
L12M Monetary is a score that sorts customers by spend amount during the previous 12 months. Each RFM score is split into ten percentile groups. The lowest percentile is 1 and the highest percentile is 10. Each percentile represents 10% of the customers who belong to that segment.
Tip Combine percentiles to build larger groups of customers. For example 9 and 10 together represent the “top 20%” while 8, 9, and 10 represent the “top 30%”. |