Calculate the percentage of unique transactions

Published August 03, 2022
Modules
Difficulty

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


  1. Create a metric that calculates the number of unique transactions.
  2. 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.

Note: This analysis uses a 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.
  1. Go to Analytics icon Analytics > Metrics > New metric.
  2. Leave the metric kind at default (Simple).
  3. Leave the type at default (Event).
  4. As the aggregator, select Count Distinct.
  5. From th Choose event dropdown list, select transaction.charge.
  6. As the event parameter, select $orderId.
  7. In the lower right corner, select the data range for which you want to analyze the data.
  8. Save the metric.
    Result:
    The configuration of the metric
    The configuration of the metric

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.

  1. Go to Analytics icon Analytics > Metrics > New metric.
  2. As the metric kind, select Formula metric.
  3. On the dashboard, click Select.
  4. From the dropdown list, select Event.
  5. Click the unnamed node.
  6. From the Choose event dropdown list, select transaction.charge.
  7. As the aggregator, select Count Distinct.
  8. In the lower right corner, set the date range to Lifetime.
  9. Click the Plus icon button.
  10. From the dropdown list, select Event.
  11. Click the unnamed node.
  12. From the Choose event dropdown list, select transaction.charge.
  13. Leave the aggregator type at default (Count).
  14. In the lower right corner, set the date range to Lifetime.
  15. Click the Plus icon button.
  16. From the dropdown list, select Number.
  17. Replace 0 with 100.
  18. Change the mathematical operators:
    1. Between the nodes with events, change the plus sign to the division sign.
    2. Between the transaction.charge node and 100, change the plus sign to the multiplication sign.
  19. Save the metric.
    Result:
    The configuration of the metric
    The configuration of the metric

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.

Read more


😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker