# Preparations

### 1. Connect the TON Connect SDK

Web3 events for the Telegram Mini Apps Analytics SDK are supported by the [`@tonconnect/ui`](https://www.npmjs.com/package/@tonconnect/ui) and [`@tonconnect/ui-react`](https://www.npmjs.com/package/@tonconnect/ui-react) libraries since version 2.0.3, [`@tonconnect/sdk`](https://www.npmjs.com/package/@tonconnect/sdk) since version 3.0.3.

[Read more about TON Connect integration](https://github.com/ton-connect)

Don't worry if your app doesn't use TON Connect, the analytics SDK will still work and collect non-Web3 events.

### 2.  Get the token with TON Builders

Register your project on [TON Builders](https://builders.ton.org) and go to the Analytics tab.

![](https://storage.googleapis.com/ton-strapi/Empty_49d500d906/Empty_49d500d906.png)

Enter your Telegram Bot URL and mini app domain to receive an **API key** for SDK initialization. You can also manage your existing keys from the same section. Enter your Telegram Bot URL and mini app domain to receive a token for SDK initialization.

### 3. Initialize SDK

Now you can initialize the SDK in your application. There are two ways to do this:

* via \<script> tag (See [Installation via \<script> tag](/sdk/installation-via-less-than-script-greater-than-tag.md) page)
* via NPM package (See [Installation via NPM package](/sdk/installation-via-npm-package.md) page)

***

### Navigation:

* [Overview](/overview.md)
* SDK installation:
  * [preparations](/sdk/preparations.md)
  * [via \<script> tag](/sdk/installation-via-less-than-script-greater-than-tag.md)
  * [via NPM package](/sdk/installation-via-npm-package.md)
* [API docs](/api/endpoints.md)
* [Supported events](/supported-events.md)
* [Bot](/managing-integration.md)
* [Demo app](https://github.com/Dimitreee/demo-dapp-with-analytics)


---

# 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.tganalytics.xyz/sdk/preparations.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.
