# Track events for analytics

An event can be anything that you would like to track at a certain point of your flow so that you can collect data for your bot analytics. In this page, you will learn to:

* [Add a Track event step](#add-a-track-event-step)
* [Find tracked events in your execution logs](#find-your-execution-logs)

{% hint style="warning" %}
The Track Event feature should not be confused with [events](https://docs.chatlayer.ai/bot-answers/events) themselves, which are used to trigger a flow based when either [a variable changed](https://docs.chatlayer.ai/bot-answers/events#variables-changed-event) or when [a silence was detected](https://docs.chatlayer.ai/bot-answers/events#silence-detected-event).&#x20;
{% endhint %}

## Add a Track event step

To add a Track event step to your chatbot:

1. Add a step to your block.
2. Click `Actions` .
3. Select `Track Event`.

{% hint style="info" %}
Track events are not compatible with [Condition](https://docs.chatlayer.ai/buildabot/flow-logic/dialog-state/plugins) blocks. Instead, you can add the Track event feature in a [Bot message](https://docs.chatlayer.ai/buildabot/flow-logic/dialog-state/message-components) before redirection.&#x20;
{% endhint %}

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FIHNQaU2mLLIEwwfXDmnZ%2FScreenshot%202023-10-24%20at%2016.36.50.png?alt=media&#x26;token=5ab01319-384f-462f-9c93-67b2226e3b72" alt="" width="375"><figcaption><p>Add a Track event step to your block</p></figcaption></figure>

2\. Click on `Name`. A list of events to be tracked will appear, if you have any, or you will be able to create a new event from here.&#x20;

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FNDgxhfDdZDecNaCRRA0F%2FScreenshot%202023-10-24%20at%2016.38.56.png?alt=media&#x26;token=33837beb-450c-4c60-944f-e5bd6d56d7cc" alt="" width="375"><figcaption></figcaption></figure>

3. Create a new event by typing a name under `Event Name`.

{% hint style="info" %}
Make sure that you create an event or select an existing one before adding key(s) and value(s).
{% endhint %}

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F9OmA9VAVy17v3Huv8pO3%2FScreenshot%202023-10-24%20at%2016.42.32.png?alt=media&#x26;token=44e09007-3745-435b-b22c-5b3b2c942f49" alt="" width="375"><figcaption></figcaption></figure>

4. From the dropdown, click on `Create`. A Create Tracking Event window will pop up.
5. Under `Event Description`, add a piece of text that explains what this event is about.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FXQQqlii9pKkHHe3ooaLQ%2FScreenshot%202023-10-24%20at%2016.44.08.png?alt=media&#x26;token=82d767cb-c481-469e-b4ab-c5e48d08c961" alt="" width="375"><figcaption></figcaption></figure>

6. Click on `Create`. Your event is now created.
7. Back to your block now. Define the attributes that will be saved with this event. Attributes are pairs of keys and values which are not mandatory, but will enrich your data. Their values can be hardcoded information or variables that you gathered previously in your flow.

{% hint style="info" %}
If you intend to use a variable gathered from a [Collect input](https://docs.chatlayer.ai/buildabot/flow-logic/dialog-state/user-input-bot-dialog) block as one of your attribute values, ensure you do so in a block that follows the Collect input.
{% endhint %}

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F6cz7POkHkfUbLAV6Gj2O%2FScreenshot%202023-10-24%20at%2016.46.17.png?alt=media&#x26;token=d854b4dd-2f45-4d49-af9d-6a0ae103afef" alt="" width="375"><figcaption></figcaption></figure>

8. Save your changes.

## Find tracked events in your Execution logs

When the block where the Track Event feature lies is triggered, it will be logged in your execution logs. &#x20;

You can find your execution logs under `History` > `Execution logs` > `Tracking events`. If you gave attributes to your event, they will also appear there.&#x20;

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FZ6zSSJwgKv8KPejARnjy%2FScreenshot%202023-10-24%20at%2016.47.47.png?alt=media&#x26;token=093178c7-caa2-407a-9684-78ad579e10ae" alt=""><figcaption><p>Execution logs where you can find your tracked events.</p></figcaption></figure>
