Health & Fitness App Event Tracking: Standardized Approach

Reteno's Health & Fitness Documentation helps track key events within fitness and health apps. It enables developers to log user actions such as tracking training, recording weight, setting goals, syncing health data, and managing subscriptions. This ensures personalized user engagement and better insights into their fitness journey.

When describing events in the system, it is important to adhere to standards to ensure a unified approach to data collection and analysis. At the initial stage, defining the key objects associated with the events is necessary. This will help to systematize the data and simplify its usage in the future. Examples of such objects may include:

  • Subscription — all events related to the user's subscription, such as starting, renewing, cancelling, and expiring subscriptions. These events must be logged from the back end using the API method.
  • User — information about the user, including their actions, preferences, and achievements.
  • Training — all aspects related to workouts, including start, completion, workout type, and calories burned.
  • Goal — the goals set by the user, their achievement, and progress in completing them.

This approach will allow for effective data management and help track user interactions with the app.

Having defined these key objects, we can now describe the events with their names corresponding to actions performed on them. This approach ensures consistency and clarity in tracking user interactions.

Here are some examples of the above-described objects.

For Subscription, events might include:

  • SubscriptionStarted – Tracks when a user starts a subscription.
  • SubscriptionRenewed – Tracks when a user's subscription is successfully renewed.
  • SubscriptionCancelled – Tracks when a user cancels their subscription.
  • SubscriptionExpired – Tracks when a user's subscription has expired.

For Training, events could be:

  • TrainingStarted – Tracks when a user starts a training session.
  • TrainingCompleted – Tracks when a user completes a training session.

For Goal, events might include:

  • GoalCreated – Tracks when a user creates a new fitness goal.
  • GoalChanged – Tracks when a user achieves a fitness goal.

These event names reflect direct actions on the corresponding objects, making it easier to monitor the app's user activity and trigger relevant notifications or updates.

General Events

TrainingStarted

Parameter

  • trainingType

Example of Usage (iOS)

Reteno.logEvent(eventTypeKey: "TrainingStarted", parameters: [("trainingType": "Cardio")])

Example of Usage (Android)

var params: List<Parameter> = listOf(
    Parameter("trainingType", "Cardio")
)
reteno.logEvent(Event.Custom("TrainingStarted", ZonedDateTime.now(), params))

TrainingCompleted

Parameters

  • trainingType,
  • duration,
  • caloriesBurned

Example of Usage (iOS)

Reteno.logEvent(eventTypeKey: "TrainingCompleted", parameters: [("trainingType": "Cardio"), ("duration": "60min"), ("caloriesBurned": "500")])

Example of Usage (Android)

var params: List<Parameter> = listOf(
    Parameter("trainingType", "Cardio"),
    Parameter("duration", "60min"),
   Parameter("caloriesBurned", 500)
)
reteno.logEvent(Event.Custom("TrainingCompleted", ZonedDateTime.now(), params))

GoalCreated

Parameters

  • goal,
  • goalWeight,
  • currentWeight,
  • caloriesNeed,
  • loseWeightSpeed

Example of Usage (iOS)

Reteno.logEvent(eventTypeKey: "GoalCreated", parameters: [("key":"goal", "value":"Lose weight"), ("key":"goalWeight", "value":"70"), ("key":"currentWeight", "value":"90"), ("key":"caloriesNeed", "value":"2000"), ("key":"loseWeightSpeed", "value":"0.5")])

Example of Usage (Android)

var params: List<Parameter> = listOf(

    Parameter("goal", "Lose weight"),

    Parameter("goalWeight", 90),
    Parameter("currentWeight", 70),
    Parameter("caloriesNeed", 2000),
    Parameter("loseWeightSpeed", 0.5)
)
reteno.logEvent(Event.Custom("GoalCreated", ZonedDateTime.now(), params))

GoalChanged

Parameters

  • goal,
  • goalWeight,
  • currentWeight,
  • caloriesNeed,
  • loseWeightSpeed

Example of Usage (iOS)

Reteno.logEvent(eventTypeKey: "GoalChanged", parameters: [("key":"goal", "value":"Lose weight"), ("key":"goalWeight", "value":"70"), ("key":"currentWeight", "value":"90"), ("key":"caloriesNeed", "value":"2000"), ("key":"loseWeightSpeed", "value":"0.5")])

Example of Usage (Android)

var params: List<Parameter> = listOf(
    Parameter("goal", "Lose weight"),
    Parameter("goalWeight", 90),
    Parameter("currentWeight", 70),
    Parameter("caloriesNeed", 2000),
    Parameter("loseWeightSpeed", 0.5)
)
reteno.logEvent(Event.Custom("GoalChanged", ZonedDateTime.now(), params))

Subscription Events (Backend Events)

SubscriptionStarted

Parameters

  • externalCustomerId,
  • subscriptionId,
  • subscriptionName,
  • price,
  • currency,
  • expireDate,
  • hasFreeTrial,
  • trialExpireDate

Example Payload

{
  "eventTypeKey": "SubscriptionStarted",
  "params": [
    {
      "name": "externalCustomerId",
      "value": "12345ABC"
    },
    {
      "name": "subscriptionId",
      "value": "SUB67890"
    },
    {
      "name": "subscriptionName",
      "value": "Premium Plan"
    },
    {
      "name": "price",
      "value": "9.99"
    },
    {
      "name": "currency",
      "value": "USD"
    },
    {
      "name": "expireDate",
      "value": "2025-01-31"
    },
    {
      "name": "hasFreeTrial",
      "value": "true"
    },
    {
      "name": "trialExpireDate",
      "value": "2025-01-15"
    }
  ]
}

SubscriptionRenewed

Parameters

  • externalCustomerId,
  • subscriptionId,
  • subscriptionName,
  • price,
  • currency,
  • expireDate
{
  "eventTypeKey": "SubscriptionRenewed",
  "params": [
    {
      "name": "externalCustomerId",
      "value": "12345ABC"
    },
    {
      "name": "subscriptionId",
      "value": "SUB67890"
    },
    {
      "name": "subscriptionName",
      "value": "Premium Plan"
    },
    {
      "name": "price",
      "value": "9.99"
    },
    {
      "name": "currency",
      "value": "USD"
    },
    {
      "name": "expireDate",
      "value": "2025-02-28"
    }
  ]
}

SubscriptionRefunded

Parameters

  • externalCustomerId,
  • subscriptionId,
  • subscriptionName,
  • price,
  • currency,
  • expireDate,
  • hasFreeTrial,
  • trialExpireDate
{
  "eventTypeKey": "SubscriptionRefunded",
  "params": [
    {
      "name": "externalCustomerId",
      "value": "12345ABC"
    },
    {
      "name": "subscriptionId",
      "value": "SUB67890"
    },
    {
      "name": "subscriptionName",
      "value": "Premium Plan"
    },
    {
      "name": "price",
      "value": "9.99"
    },
    {
      "name": "currency",
      "value": "USD"
    },
    {
      "name": "expireDate",
      "value": "2025-01-31"
    },
    {
      "name": "hasFreeTrial",
      "value": "false"
    },
    {
      "name": "trialExpireDate",
      "value": "2025-01-15"
    }
  ]
}

SubscriptionCancelled

  • externalCustomerId,
  • subscriptionId,
  • subscriptionName,
  • price,
  • currency,
  • reason
{
  "eventTypeKey": "SubscriptionCancelled",
  "params": [
    {
      "name": "externalCustomerId",
      "value": "12345ABC"
    },
    {
      "name": "subscriptionId",
      "value": "SUB67890"
    },
    {
      "name": "subscriptionName",
      "value": "Premium Plan"
    },
    {
      "name": "price",
      "value": "9.99"
    },
    {
      "name": "currency",
      "value": "USD"
    },
    {
      "name": "reason",
      "value": "User requested cancellation"
    }
  ]
}