Build your own web analytics platform using Tinybird's Events API and Endpoints. Built with privacy and speed as top priorities, this template lets you get real-time metrics in a pre-built dashboard in just a few minutes without any knowledge about Tinybird. Our free accounts serve up to 1000 requests per day and unlimited processed GB, more than enough to get started.
After you've finished the basic setup, expand your analytics with custom events tailored to your specific use cases (eCommerce, marketing, etc.), keeping the same real-time performance.
To deploy this template on Tinybird, click the following button:
Follow the guided process, and your Tinybird workspace is now ready to start receiving events. All your Data Sources, Materialized Views, and API Endpoints should be installed and ready. If you go to the Data Flow tab, you should see something like this:
Copy the snippet from the banner and paste it within your site <head>
section:
The snippet looks like this:
<script
defer
src="https://unpkg.com/@tinybirdco/flock.js"
data-token="YOUR_TRACKER_TOKEN"
></script>
If everything is working correctly, you should start seeing rows in your Data Source as visitors view and interact with your website:
Now you'll see a banner with a link to the dashboard. Click to open it:
Alternatively, you can always navigate to https://analytics.tinybird.co/ and paste your dashboard
token.
You'll find this dashboard
token already created for you on the Tinybird UI, under Manage Auth Tokens.
- Create a Tinybird account.
- Create a Workspace and go to Manage Auth tokens to copy your admin token.
- Clone this repository:
git clone https://github.com/tinybirdco/web-analytics-starter-kit
cd web-analytics-starter-kit
cd tinybird
-
Install the Tinybird CLI using
pip install tinybird-cli
. Detailed instructions here. -
Authenticate on the CLI using
tb auth
and paste the token you just copied. -
Push the project using
tb push
.
If you want to customize & host your own dashboard, you can easily deploy the project to Vercel using the button below:
These parameters can be used with the example tracker snippet:
Parameter | Mandatory | Description |
---|---|---|
data-token |
Yes | Your tracker token. It's already created for you, you can find it on the Tinybird UI under "Manage Auth Tokens" |
data-proxy |
No | Your domain URL to proxy the request, if you follow the optional steps for "GDPR Best Practices" |
data-host |
No | Tinybird host URL. Ddefaults to https://api.tinybird.co/ , but could be https://api.us-east.tinybird.co or a dedicated cluster. The banner already generates the snippet with the proper host. |
data-datasource |
No | If you iterate the landing data source, or you just want to ingest the event in a different one, you can specify the landing data source name. |
The script also provides you with a function to send custom events. You can simply add this to your application at any point:
Tinybird.trackEvent('add_to_cart', {
partnumber: 'A1708 (EMC 3164)',
quantity: 1,
})
You can also fork the dashboard project in this repository and create custom components for your new events. It's a Next.js project, so you can deploy it easily on Vercel.
You can include custom attributes in the import library snippet. Attributes name must have tb_ prefix. Every attribute included with this requirement would be saved in the payload column of your analytics_events datasource and will be included in every event. For example:
<script
src="https://unpkg.com/@tinybirdco/flock.js"
data-token="TOKEN-ID"
tb_customer_id="CUSTOMER_ID"
></script>
Would append customer_id:CUSTOMER_ID to the rest of variables saved in payload column.
Tinybird is GDPR compliant as a platform, but it is your responsibility to follow GDPR's rules on data collection and consent when implementing your web analytics.
Need help?: Community Slack • Tinybird Docs