Connecting a Mini App
To connect a Mini App, you need to add it on the relevant page (Mini Apps).
Mini App Setup
The system will ask you to choose the bot to which the Mini App belongs and its system name.
The system name is necessary for matching data received by the bot. If you enter an incorrect name, the system will create a Mini App with the name found, which may cause data confusion.
Adding a Counter to the HTML Code of the Mini App
After adding the Mini App to graspil, you will receive a key and a code that needs to be added to your Mini App.
Replace the placeholder <--YOUR CODE-->
in line 5 with the key you received:
This code should be added in the <head>
section of your application.
Event Tracking
By default, the system collects click events on buttons and links, as well as all events generated by Telegram.
For clicks, the event names are derived from the button and link content. You can pass custom events by adding the data-gs-event attribute to HTML elements.
Custom Events
You can pass custom events by running the following code:
event
string
yes
Event name
category
string
no
Event category
value_num
float
no
Numerical value, such as price (a floating-point number)
unit
string(3)
yes, if value_num is provided
UTM Tracking
UTM Tag Processing Rules
How to Add UTM Tags?
Tags are added similarly to the ones in the bot, with one exception: instead of using start
, you need to use the parameter startapp
.
Example:https://t.me/graspil_bot/app?startapp=source-doc
Tracking Launch Buttons
By default, graspil can identify where the Mini App was launched from—either a public channel/chat or your bot. However, you also have the option to configure tracking for launches from specific buttons.
For example, your bot might offer users three buttons to launch the Mini App:
Menu Button (the standard button next to the input field)
“Open App” Button on the bot’s page (where the bot description and username are shown)
Most likely, you also send a welcome message to users with a button to launch the app
For each of these buttons, you can define an HTTPS address for your app. For instance: https://example.com/myapp
If you add the parameter gs_source=my_button
to this URL, this value will be used as the session source in the Mini App, and you’ll be able to see this data in the corresponding reports.
Examples:
Using the buttons listed above as examples, we’ll add the gs_source parameter to each link:
• Menu Button: https://example.com/myapp?gs_source=menu_button
• “Open App” Button: https://example.com/myapp?gs_source=main_button
• Start Message Button: https://example.com/myapp?gs_source=start_msg
You can use the gs_source
parameter anywhere you have a direct link to the app. For all other cases, use UTM tags.
Last updated