Analytics
Analytics guide for your application.
Setup
To get started with analytics integration, you'll need to configure your analytics provider. Follow these steps:
- Choose an analytics provider (Mixpanel or Firebase Analytics) and create an account. MixPanel is already set up in the project, but you can also use Firebase Analytics if you prefer.
- Obtain your API keys and any other necessary credentials.
- Configure your analytics provider settings in your application.
These values should be stored in the following environment variables:
# Tracking
MIXPANEL_TOKEN=
# Firebase keys
FIREBASE_API_KEY=
FIREBASE_AUTH_DOMAIN=
FIREBASE_PROJECT_ID=
FIREBASE_STORAGE_BUCKET=
FIREBASE_MESSAGING_SENDER_ID=
FIREBASE_APP_ID=
FIREBASE_MESUREMENT_ID=
Here's an example of how to use Mixpanel for tracking events:
import mixpanel from 'mixpanel-browser';
mixpanel.init(process.env.MIXPANEL_TOKEN);
mixpanel.track('Event Name', {
property1: 'value1',
property2: 'value2',
});
Inside src/lib/events.ts
you already have the MixPanel integration set up. You can use the track functions to track events throughout your application.
You can use the same logic to implement Firebase Analytics tracking.
And that's it! You should now be able to track events in your application.