Quick Start
Here you will find all the relevant resources to get up your analytics up and running!
Overview
Welcome to the Telemetree Quick Start Guide! This guide is your first step toward integrating Telemetreeβs analytics into your Telegram Mini App or TON project. Whether you're a seasoned developer or just starting, we've designed this guide to help you smoothly integrate our SDKs into your application. By the end of this guide, you'll have Telemetree up and running, ready to gather valuable insights from your users.
Prerequisites
Before diving into the integration process, let's ensure you have everything needed to get started:
- Basic Knowledge: Familiarity with the development environment for the Telegram ecosystem.
- Development Environment: Ensure you have the necessary development tools installed. For frontend integration, you should have a React environment set up. For the backend, Python, NodeJS, or Go environments are required based on your project's needs. However, we also provide API endpoints for you to upload your data.
- Telemetree Account: Currently, Telemetree is in the closed beta testing stage, so if you don't have an account, please, fill out our waitlist form, and we'll reach out to you shortly. Once, the application is approved, we will provide you with access to your unique API keys.
Installation & Setup
Resources
Installing React Frontend SDK
- Install the Telemetree React SDK using npm or yarn:
npm install @tonsolutions/telemetree-react
or
yarn add @tonsolutions/telemetree-react
- Initiate the library:
Installing Python Backend SDK
- Install the Telemetree Python SDK via pip:
pip install temetree
- Initiate the library and connect to your webhook endpoint:
from fastapi import APIRouter, Request
from telegram import Update
from telemetree import TelemetreeClient
router = APIRouter()
telemetree = TelemetreeClient(
"your_api_key", "your_project_key"
)
@router.post("/webhook")
async def webhook(request: Request):
"""Telegram webhook endpoint."""
incoming_request_json = await request.json()
telemetree.track(incoming_request_json)
de_json_object = Update.de_json(data=await request.json(), bot=application.bot)
await application.update_queue.put(de_json_object)
Frontend Events Tracking
Manual Tracking
If you don't want to rely on our auto-tracking solution, you can use TWAEvent
hook to track events within your application. Mark the most important events that you wish to track with it, and they will be sent to our data pipeline:
Once the SDK is installed and the provider is wrapped around your application, you can start tracking events right away. The track
method can be used to send various user events to Telemetree, which will process and display the analytics data in your dashboard.
Web Dashboard: Frontend Tracking Settings
Learn more!
If you are looking to learn more about our dashboards and the tools that we are providing, please, follow this link.
Enabling Autocapture
Telemetree simplifies event tracking within your Mini App by providing an Auto Capture feature. When enabled, this feature automatically captures specified interactions without the need for a manual event tracking setup.
Configuring Capture Tags & Classes
- Capture Tags: You can define which HTML tags Telemetree should monitor. For example, if you want to track all button clicks, simply add a button to the Capture Tags.
- Capture Classes: Similarly, you can specify classes for Telemetree to track. If you have a class named purchase-button, adding it to Capture Classes ensures all interactions with elements of this class are captured.
Selecting Telegram-Specific Events
Telemetree understands the unique aspects of the Telegram Mini App environment. You can choose from a variety of Telegram-specific events to track, such as:
- Main Button Pressed
- Settings Button Pressed
- Invoice Closed
- Popup Closed
- QR Code Scanned
- Write Access Granted/Rejected/Requested
- Contact Request Accepted/Rejected/Sent
To select these events, simply check the corresponding boxes in the Telemetree dashboard settings. This tailors the tracking to your specific needs, ensuring you gather the most relevant data for your analysis.
Telegram Event Tracking
Manual Event Tracking
Web Dashboard: Bot Tracking Settings
Learn more!
If you are looking to learn more about our dashboards and the tools that we are providing, please, follow this link.
Enabling Event Forwarding
Telemetree's backend analytics enable the tracking of events and commands within the Telegram ecosystem. By toggling on Forward Events, Telemetree will capture and analyze activities related to your bot or Telegram app.
Configuring Capture Commands
- Capture Commands: Specify which bot commands you wish to track, such as
/start
,/help
, or custom commands. To capture data on these, simply add the command triggers to the Capture Commands field. - Capture Messages: If you need to track specific keywords or phrases within messages, add them to the Capture Messages field. This allows you to gather data on how users interact with your bot through natural language input.
Selecting Telegram-Specific Events
For a more granular analysis, you can select from a list of Telegram-specific events. This ensures you're capturing the right data that's most relevant to your bot's operation and user engagement. Options include:
- Inline Query Called
- Chosen Inline Query Result
- Bot Locked
- Shipping Query
- Pre Checkout Query
- Bot Added To Chat
Simply check the boxes next to these events in the Telemetree dashboard to start tracking them.
Updated 8 months ago
If you want to learn more about our SDKs or data visualization, please, follow these links: