Explore SDK

How to install and manage

Telegram Mini Apps is an SDK and API that turns your Telegram Mini App into a source of valuable data. With this tool, you get instant access to key metrics that help you understand how users interact with your application and what steps need to be taken to optimize it. It supports off-chain events and on-chain events from TON Connect SDK.

How to install it?

1. Add Telegram Mini Apps Analytics to your project

Include the Telegram Mini Apps Analytics script in the header of your HTML document. This script will allow you to track and analyze user interactions effectively.

<!-- Add Telegram Analytics script to HTML head -->
<script async src="https://tganalytics.xyz/index.js" type="text/javascript"></script>

Alternative solution (not recommended)

<!-- Add Telegram Analytics script to HTML head -->
<script async src="https://unpkg.com/@telegram-apps/[email protected]/dist/index.js" type="text/javascript"></script>

2. Connect the TON Connect SDK

@tonconnect/[email protected] and @tonconnect/[email protected] supports info about Web3 events for Telegram Mini Apps Analytics SDK.

Read more about integration

3. Get the token with @DataChief_bot

Initiate a conversation with our Data Chief. It will assist you in generating a unique access token required for the analytics records. Additionally, you can manage your existing tokens through this bot.

Provide to Data Chief bot your Telegram Bot URL, and domain where your mini app is hosted and you will receive a token to initialise the SDK

5. Initialize the Telegram Mini Apps Analytics SDK

Once you have your unique access token and app name, you can initialize the Telegram Analytics SDK in your code. This step is crucial for enabling the tracking of events without repeatedly transferring the token.

// Initialize Telegram Analytics SDK
window.telegramAnalytics.init({
    token: 'YOUR_TOKEN',
    appName: 'APP_NAME',
});

Supported Events

After initializing the Telegram Analytics, you are all set to transfer the data, gain insights, and improve user engagement. (99% of them will be tracked automatically without manual control)

Read more about supported events

Last updated