> For the complete documentation index, see [llms.txt](https://lionstudios.gitbook.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lionstudios.gitbook.io/readme/analytics/custom-events.md).

# Custom Events

## Custom Events

## Introduction

Lion Analytics supports the creation of custom events. Custom events often lead to redundancy and inefficiencies as they typically replicate existing predefined events or create niche events that are unnecessary.

{% hint style="warning" %}
We strongly discourage their use. Our SDK is designed to cover a wide range of event tracking needs across various game genres with its predefined events.
{% endhint %}

## Overview

Custom events are any events that:

* Are not predefined in the Lion Analytics module.
* Mimic predefined events but do not adhere to the standard event schema (i.e., they include different parameters).

### Why Custom Events Should Be Limited

The Lion Analytics framework is designed to standardize event tracking to ensure efficient data processing and analysis. Using custom events can lead to several issues:

* **Redundancy**: Custom events often duplicate the functionality of existing events.
* **Inefficiency**: Custom events require additional work for ETL (Extract, Transform, Load) tasks and data modeling, impacting our ability to provide timely and accurate insights.
* **Data Consistency**: Standard events ensure consistency in data collection, making it easier to maintain and analyze data across multiple games.

### When to Use Custom Events

Custom events should only be considered when absolutely necessary and when no existing predefined event can fulfill the tracking requirement. Always refer to the predefined events first and consult the decision flow to determine if a custom event is needed.

### Example Mapping

Instead of creating custom events, map your use cases to the predefined Lion Analytics events. Here are some examples:

| Use Case                             | Custom Event                                                | Standard Event                                                                                |
| ------------------------------------ | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| Completing a task                    | task\_abc\_complete                                         | mission\_complete → mission\_name = “task\_abc”                                               |
| Trading an item for in-game currency | sell\_item → item\_name = “costume 1” → earned\_coins = 100 | economy → product\_spent = “costume 1” → product\_received = “coins” → received\_amount = 100 |
| Unlocking a new level                | unlocklevel.10                                              | feature\_unlocked → feature\_type = “level” → feature\_name = “10”                            |
| Reaching a high score                | score.50                                                    | achievement → achievement\_name = “score.50”                                                  |
| Purchasing an IAP                    | iap.com.bundle.starter                                      | inapp\_purchase → product\_id = “iap.com.bundle.starter”                                      |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lionstudios.gitbook.io/readme/analytics/custom-events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
