How do analytics and reports work?
At the core of every analytics process are events. An event is usually some kind of user action: a bot launch, opening a website page, clicking a button, a purchase, a user churn, sending a message, etc.
Each event has several parameters, the main ones being:
date- the date and time the event occurreduser_id- the user who performed the event. Can be 0 - such events are called anonymousevent_id/event_name- the name of the event that occurredcategory_id/category_name- the event category, for additional categorization of eventsvalue_int- a numeric value, this can be a sale amount or any other numeric value. For monetary events, the value is stored in the smallest unit of the currency (e.g. kopecks for RUB) — exactly as it was sent viavalue_num/unit, with no conversion appliedunit- the unit of measurement, for example usdvalue_amount- a computed field available only in reports (not a stored column): it convertsvalue_intback into normal units (rubles rather than kopecks) and converts it at the current exchange rate into the currency set in your profile. Use this instead ofvalue_intwhenever you're summing money — see Trends for detailsetc...
All events are stored as one large table, which can be queried to build various reports.
To build truly useful reports it is critically important to collect all the necessary events; it's impossible to build a report on the number of sales if we physically don't have sales events.
How do you collect events?
When you connect graspil, you automatically get access to a fairly wide set of events. However, every product is unique and requires individual configuration. For this, the following tools are available to you:
API - the API lets you pass events even in the most complex cases
Triggers - you can set conditions under which an event will be created. For example, your bot sends a message after a sale with the text "Thank you for your purchase"; you can create a trigger that looks for the phrase "Thank you for your purchase" in messages and creates an event
Automation - when creating automations you can also create events.
Sending events from a mini app - you can create events on specific clicks or actions.
Following outbound links - if a user follows a link from a bot or channel, there is a way to create an event on that click.
Which events are created automatically in graspil?
When you connect a resource, a large set of standard events becomes available automatically — bot launches and blocks, messages, payments, mini app actions, broadcasts, and more. See the full list with names and explanations on the Event reference page.
Last updated