Analytics

Learn how to configure analytics in your project.

Configure Analytics

I've chosen Tinybird as the analytics provider for this project, due to its ease of use and cheap usage pricing. It's free to get started.

We're going to configure analytics both for the marketing site and the dashboard site.

You may choose to use any analytics provider you prefer.

Create an account

Create an account and login on Tinybird.

Choose your desired region

Choose the region where you want to store your data.

Create a workspace

Choose a workspace name such as YOUR_PROJECT_NAME_MARKETING.

Choose Web Analytics as the starter kit.

Click on Create Workspace.

Update the environment variables for the marketing site

You will see a snippet of code.

Copy the value next to src and paste it beside the NEXT_PUBLIC_TINYBIRD_SRC in the .env.

Copy the value next to data-host and paste it beside the NEXT_PUBLIC_TINYBIRD_DATA_HOST in the .env.

Copy the value next to data-token and paste it beside the NEXT_PUBLIC_TINYBIRD_ANALYTICS_MARKETING_TRACKER_TOKEN in the .env.

Bookmark the analytics dashboard URL

Click the visualize tab and then click on the View dashboard button.

Bookmark this URL for easy access and future reference.

Configure analytics for the dashboard site

Repeat the same steps as above for the dashboard workspace.

Begin by creating a new workspace with the name YOUR_PROJECT_NAME_DASHBOARD. You can easily create new workspaces and switch between them by clicking on the workspace name in the top left corner.

Once you have the workspace created, copy the data-token and paste it beside the NEXT_PUBLIC_TINYBIRD_ANALYTICS_DASHBOARD_TRACKER_TOKEN in the .env.

Bookmark the dashboard URL for easy access and future reference.

Congratulations! You have successfully configured analytics for your projects.

Do note that I've disabled analytics tracking in development mode, so you won't see any data in the dashboard until you deploy the project.

Last updated on