Platform

Understand user behavior by tracking any event with one line of code

Introduction

The Custom event report is definitely the most powerful feature of the Analytics reports. It is designed to conduct comprehensive evaluations of all tracking activities in your app as simple as possible. By using this feature, in essence, you will be able to track any event with simple frontend code setup.

Custom Events reports will help you understand how your users behave and interact with your app, thereby enabling you to make informed decisions regarding your app’s marketing and performance optimization.

This Analytic Report will work only if the Parse Server version of your app is equal to or greater than 2.8.4.
If you want to manage your Parse Server Version for 2.8.4, follow these instructions.

Frontend Code Set up

Custom events reports allow you to track ongoing, free-form events easily as well as measure their activities. To do so, you first need to set up an event with simple frontend code.

For example, imagine that you have an app for your barber shop developed with a scheduling system in which the client must choose the service, professional, date, and time when booking an appointment.

If you want to track the frequency of scheduled appointments for a specific service with a specialist, you need to identify that the client opted for that particular service and specialist, and then send a custom event with two dimensions:

  • First dimension - the service type, let’s say ‘haircut’;
  • The second dimension - a string containing the name of the professional barber, let’s say ‘John’.

The code that works wonder, in several programming languages, is structured below.

1
2
3
4
5
6
Map<String, String> dimensions = new HashMap<String, String>();
// Define ranges to bucket data points into meaningful segments
dimensions.put("service", "Haircut");
dimensions.put("professional", "John");
// Send the dimensions to Parse along with the event
ParseAnalytics.trackEventInBackground("myEventName", dimensions);
1
2
3
4
5
6
7
NSDictionary *dimensions = @{
  // Define ranges to bucket data points into meaningful segments
  @"service": @"haircut",
  @"professional": @"John"
};
// Send the dimensions to Parse along with the event
[PFAnalytics trackEvent:@"myEventName" dimensions:dimensions];
1
2
3
4
5
6
7
let dimensions = [
  // Define ranges to bucket data points into meaningful segments
  "service": "haircut",
  "professional": "John",
]
// Send the dimensions to Parse along with the event
PFAnalytics.trackEvent("myEventName", dimensions:dimensions)
1
2
3
4
5
6
7
var dimensions = {
  // Define ranges to bucket data points into meaningful segments
  service: 'haircut',
  professional: 'John'
};
// Send the dimensions to Parse along with the event
Parse.Analytics.track('myEventName', dimensions);
1
2
3
4
5
6
7
var dimensions = new Dictionary<string, string> {
  // Define ranges to bucket data points into meaningful segments
  { "service", "haircut" },
  { "professional", "John"}
};
// Send the dimensions to Parse along with the event
ParseAnalytics.TrackEventAsync("myEventName", dimensions);

Back4App Set up

Once you have included tag attributes specifying name and dimensions of the event in your frontend code, you can start using the Custom events reports of your app. To do so, follow the steps given below:

  1. Go to Back4App Website and click on My Apps. Find your app and then click on DASHBOARD.
  2. Select More > Analytics section and click on Explorer > Chart under the Analytics tab.
  3. Now, click on the Add query button that is located right below the Explorer title and then select the Build a custom query button of the Choose a query to visualize chart, as shown below.

    If you don’t see the Add query button, scrool up a little bit.

  4. Select Filter input rows.

Exploring the report

To explore the Custom events report, follow these instructions:

  1. Enter a keyword relevant to your custom event query. You can filter your query based on an event name that is: equal to your keyword, not equal to your keyword or contains your keyword.
  2. Finally, click on the Add query button.
  3. Click on the Calendar icon at the right bottom corner of your Dashboard.

    If you don’t see this icon, scroll down a little bit.

  4. Once the calendar is opened, select specific dates to execute your audience query. You need to enter a beginning date of the query in the left part and an ending date in the right section of the calendar.

    You can toggle the months by using the top arrows icons displayed in the calendar box.

  5. Now, click on Run query.

    Now, you should see a graph, a line chart precisely, representing the frequency of your custom event for a particular time range selected by you (in the previous step), as shown in the image below.

It’s done!

Well done! You have splendidly learned how to use Custom events reports of your app to understand user behavior and track any event with just one line of code through Back4App!