Analytics Setup
If you're already using Wiredash, you're all set! Our analytics feature is automatically enabled, giving you instant access to real-time insights. Head to your console's analytics page to start exploring.
INFO
Beta Note: Analytics is still under development. We're actively adding features like page/route tracking. Have an idea? Let us know using the console's feedback form or email us at support@wiredash.com.
Not using Wiredash yet? Our 3-minute quickstart will get you up and running in no time.
For more info on how our analytics work or what data is being collected, head over to FAQ section.
Custom Events
With the Wiredash SDK, you can track custom analytics events to gain insights into user interactions and significant occurrences within your app.
Custom event tracking is still in beta and only available for paid plans.
Track Events
To track an event, use the Wiredash.trackEvent
method for easy access throughout your app.
await Wiredash.trackEvent('Click Button', data: {/**/});
Event Naming Constraints
- Length: 3 to 64 characters
- Allowed Characters: Letters (a-zA-Z), numbers (0-9),
-
,_
, and spaces - Start with: A letter (a-zA-Z)
- Prohibited: Double spaces, double or trailing spaces
Data Constraints
- Key-Value Pairs: Maximum of 10
- Key Length: Up to 128 characters, must not be empty
- Value Types: String, int, bool, null
- Value Length: Each value must not exceed 1024 characters after JSON encoding
Event Sending Behavior
- Batching: Events are batched and sent every 30 seconds (directly on web).
- Initial Delay: The first batch is sent after a 5-second delay so Wiredash doesn't slow down your app's startup.
- App Background: Events are sent immediately when the app goes to the background.
- Network Issues: Events are stored locally and retried later if sending fails.
- Retention: Unsent events are discarded after 3 days.
Background Isolates
When trackEvent
is called from a background isolate, the event is stored locally. The main isolate will send these events automatically with the next batch or latestwhen the app goes to the background.
Handling Multiple Wiredash Widgets
Access the closes Wiredash
widget using the Wiredash.of(context)
method.
Wiredash.of(context).trackEvent('Click Button');
Don't have a context? If your app has multiple Wiredash widgets with different projectIds, specify the desired projectId when creating WiredashAnalytics
to ensure the event is sent to the correct project.
final analytics = WiredashAnalytics(projectId: 'your_project_id');
If no projectId
is provided and multiple widgets are mounted, events are sent to the project associated with the first mounted widget, and a warning is logged to the console.
Using WiredashAnalytics during testing
Wiredash will not send events in your widget tests. The detection happens automatically.
If you want to test that a user action triggered an analytics event, use the WiredashAnalytics
class, which you can mock easily using your favorite mocking library.
final analytics = WiredashAnalytics();
await analytics.trackEvent('Click Button', data: {/**/});
// Inject into other classes
final bloc = MyBloc(analytics: analytics);
// mock in your tests
final mockAnalytics = MockWiredashAnalytics();
final bloc = MyBloc(analytics: mockAnalytics);
await block.doSomething();
verify(() => mockAnalytics.trackEvent('Click Button')).called(1);