# User Tracking

If you have a `dataLayer` variable defined on the page that the OpenDialog bot lives on, a number of events that happen in the chatbot will be passed to it as the bot is used.

### Events

The current list of events sent:

#### Chatbot Events

These are triggered by the user open/closing or interacting with the chat window

* `chat_displayed` - Triggered when the chat is first displayed to the user
* `chatbot_minimized`- Triggered when the chatbot is minimised
* `chatbot_maximized`- Triggered when the chatbot is opened
* `download_chat_transcript`- Triggered when the user downloads the transcript, if the option if available.
* `end_chat` - Triggered when the user clicks on the 'end chat' link
* `confirm_end_chat`- Triggered when user clicks on 'yes' after the clicking on 'end chat'
* `url_clicked` (along with `url clicked` and `text`) - Triggered when a user clicks on an outboard link.

#### Message Events

These events related directly to messages sent from the user or the chatbot

* `form_submitted` (along with `callback_id`and `message text`) - Triggered when the user submits a form.
* `form_cancelled` (along with `callback_id`) - Triggered when the user cancels a form submission.
* `user_clicked_button_in_chatbot` (along with `label`) - Triggered when the user clicks on any button within the chatbot.
* `message_sent_to_chatbot` - Triggered each time the user interacts or responds to the chatbot
* `message_received_from_chatbot` (along with `message id`) - Triggered each time the chatbot sends a message.

{% hint style="info" %}
The 1.0 version is currently in development - we will be adding more as we go on!
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://docs.opendialog.ai/developing-with-opendialog/webchat/user-tracking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
