Create a report that counts purchases among specific product groups

Published August 12, 2022
Modules
Difficulty
Selected Clients
mediaexpert logo

While creating a purchase analysis of specific products, we often want to group them according to specific rules, for example, by their category. However, the product category is not always added to the parameters of the transaction event. In this case, you can use the Analytics module, which creates the necessary parameter on the fly without changing the integration.

In this use case, you’ll learn how to create category parameters on the fly using Synerise Analytics and how to create a report that shows how many purchases were made for products in the defined categories.

Prerequisites


  • Implement transaction events using SDK or API.
  • Prepare a list of product SKUs that you would like to group into specific product categories.

Process


  • Create an expression that groups sold products into categories based on their SKU.
  • Create a metric that returns the number of products purchased within the defined category.
  • Create a report that shows the metric result broken down into defined groups (product categories).

Group sold products by their category with SKU


Note: In our case, event expression is be based on the products SKU. Hovewer, it is only the example of the configuration of the expression. Depending on your business needs and parameters used in the product events, you can create any conditions that can be based for example on fragment from the product name, url, and any other conditions.

In this part of the process, you will create an event expression for the product.buy event. The formula of this expression will assign a product with a given SKU to a specific product category.

Tip: Groups of these SKUs have a repeating string in the middle (for example, one SKU has ZZXXXXYY and another has AAXXXXBB)

If the SKU is included in the group corresponding to the regular expression conditions (constant with the value “.XXXX.”), then the expression assigns it to the product group (for example, constant with the value Laptop). The next groups of products will be added in the same way. If the product doesn’t meet the expression conditions, it will be assigned to the other category.

  1. Go to Profiles icon Analytics > Expression > New expression.
  2. Enter the name of the expression.
  3. Set the Expression for option to Event.
  4. From the dropdown list, select product.buy.
  5. Build the expression as shown in the screenshot below:
Expression configuration
Expression configuration

Create a metric


Create a metric to receive the number of purchased products of the groups defined in the previous step.

  1. Go to Profiles icon Analytics > Metrics > New mertic.
  2. Enter the name of the metric.
  3. As a metric kind, select Simple metric.
  4. As the aggregator, set Count.
  5. As the occurrence type, set All.
  6. From the Choose event dropdown list, select product.buy event.
  7. Click Where button.
    Result: The Choose parameter button appears.
  8. Click the Choose parameter button.
    Result: A pop-up appears.
  9. On the pop-up, click the three-dot button
    Result: A dropdown shows.
  10. From the dropdown, select Expressions.
  11. In the list of expressions, find the event expression you have created earlier.
  12. Click the Choose parameter button.
  13. From the dropdown, select Not equal.
  14. In the text field, enter other.
  15. To select a specific time range, click the calendar icon.
  16. Confirm your choice with the Apply button.
  17. Save metrics.
Metrics configuration
Metrics configuration

Create a report


In this part of the process, create a report based on the metric and expression you prepared before. The result of the report is a table with the number of purchased products in each category over a specified time period.

  1. Go to Profiles icon Analytics > Reports > New report.

  2. Enter the name of the report.

  3. Select metric you created in this part of the process.

  4. From the Range dropdown list, select the number of top (the most frequently bought group of products) to be shown in the preview of the report.

    Tip: The selected number of product groups in the range must be greater than the number of product groups defined in the expression - for the report to pull them all in.
  5. In the Dimension section, select the expression created in this step.

  6. In the date range, select the time that will be analyzed.

  7. Save the report.

  8. Click Preview to see the results.

Report configuration
Report configuration

Preview the results of the report:

Report preview
Report preview

The sold products presented in the report are grouped according to predefined categories. You can use this data to compare whether sales of a particular product group have increased during the period of interest. If there has been a noticeable increase in product group sales, there is likely to be a fraud.

In this case, you can implement an alert system using email alert/sms alert nodes or outgoing integration. You can take inspiration from the following use case, which describes the process of creating a workflow that sends alert messages based on the results of metrics to a Slack channel.

Check the use case set up on the Synerise Demo workspace


You can check the configuration of each step from this use case in 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