Calculate the percentage of unique transactions
An accurate analysis of the transaction is a must for businesses. By using the Synerise Analytics module, you can calculate the number of transactions for a specific period. To make sure you receive a reliable result, use an aggregator which lets you exclude duplicated transactions in case some occur in your workspace, for example due to duplicate data from an external source used in an import.
Additionally, you may calculate the ratio of the unique transactions to all transactions to find out the scale of duplicated transactions in your workspace.
This use case describes a process of creating metrics on the basis of the transaction.charge
event and the $orderId
event parameter. One of them counts only the number of all unique transactions with the use of the Count Distinct aggregator. The other calculates the percentage of unique transactions through a mathematical formula.
Prerequisites
Implement transaction events either through SDK or API.
Process
- Create a metric that calculates the number of unique transactions.
- Create a metric that calculates the ratio of unique transactions to all transactions.
Calculate the number of unique transactions
Create a metric on the basis of the transaction.charge
event to count the unique occurrences of the event with an $orderId
parameter.
transaction.charge
event, which is generated after a purchase as a summary of an order (as opposed to product.buy
which is generated separately for each item from a specific order). The names of the events may be different in your workspace.- Go to Analytics > Metrics > New metric.
- Leave the metric kind at default (Simple).
- Leave the type at default (Event).
- As the aggregator, select Count Distinct.
- From th Choose event dropdown list, select transaction.charge.
- As the event parameter, select $orderId.
- In the lower right corner, select the data range for which you want to analyze the data.
- Save the metric.
Result:
Calculate the percentage of unique transactions
Create a metric with a mathematical formula which calculates the ratio of unique transactions to all transactions in your workspace.
- Go to Analytics > Metrics > New metric.
- As the metric kind, select Formula metric.
- On the dashboard, click Select.
- From the dropdown list, select Event.
- Click the unnamed node.
- From the Choose event dropdown list, select transaction.charge.
- As the aggregator, select Count Distinct.
- In the lower right corner, set the date range to Lifetime.
- Click the button.
- From the dropdown list, select Event.
- Click the unnamed node.
- From the Choose event dropdown list, select transaction.charge.
- Leave the aggregator type at default (Count).
- In the lower right corner, set the date range to Lifetime.
- Click the button.
- From the dropdown list, select Number.
- Replace
0
with100
. - Change the mathematical operators:
- Between the nodes with events, change the plus sign to the division sign.
- Between the transaction.charge node and
100
, change the plus sign to the multiplication sign.
- Save the metric.
Result:
What’s next
You can display the metrics you created on a dashboard, which will help you present them in a convenient and readable form.
Additionally, you may use one of the metrics in an alert system that notifies you when the metric result deviates from the norm. To create such an alert, you can use the Automation module, create a workflow and include a Metric Filter node. If the metric results exceeds a specific number, you can send an email alert, SMS alert, or a message to a third party tool by using Outgoing Integration.
Check the use case set up on the Synerise Demo workspace
You can check the configuration of both metrics on our Synerise Demo workspace:
If you don’t have access to the Synerise Demo workspace, please leave your contact details in this form, and our representative will contact you shortly.