Telegram Mini Apps Analytics SDK
  • Overview
  • SDK
    • Preparations
    • Installation via <script> tag
    • Installation via NPM package
  • API
    • Endpoints
  • Supported events
  • Bot
  • FAQ
    • How can I check the integration status of the SDK?
Powered by GitBook
On this page
  • How to install it?
  • Supported Events
  • Navigation:
  1. SDK

Installation via NPM package

How to install and use via <script> tag

Last updated 3 months ago

How to install it?

1. Install the NPM package in your project

npm install @telegram-apps/analytics
yarn add @telegram-apps/analytics
pnpm add @telegram-apps/analytics

2. Add Telegram Mini Apps Analytics in code

Once you have your unique access token (if not, see page) and install NPM package, you can initialize the Telegram Analytics SDK in your code. To ensure that all events are collected correctly, you must initialize the SDK before the application starts rendering. For example, in react applications, before calling the render() function

import TelegramAnalytics from '@telegram-apps/analytics'

TelegramAnalytics.init({
    token: 'YOUR_TOKEN',
    appName: 'ANALYTICS_IDENTIFIER',
});

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)


Navigation:

  • SDK installation:

Preparations
Read more about supported events
Overview
preparations
via <script> tag
via NPM package
API docs
Supported events
Bot
Demo app