Skip to main content

Overview

All events you track with Grain are automatically sent to your analytics dashboard at grainql.com/dashboard. This guide shows you how to structure your events effectively to get the most actionable insights.
Custom Analytics UIs: Build custom analytics dashboards using the Query API. The Query API allows you to programmatically access your analytics data and create tailored experiences.

Accessing Your Analytics

After tracking events with the SDK, view them in your dashboard:
  1. Go to grainql.com/dashboard
  2. View real-time event streams
  3. Analyze event properties and patterns
  4. Filter by user IDs and properties
  5. Build custom reports and visualizations
  6. Export data for further analysis

Use Descriptive Event Names

Clear, specific event names make your analytics easier to understand:
Use underscores (_) for consistency and readability.

Include Rich Context

Add relevant properties to every event for deeper analysis:
The more context you provide, the better insights you’ll get from your dashboard.

Use Template Events

Grain provides pre-built template events for common scenarios:
These template events ensure consistent tracking across your app.

Track User Properties

Use properties to segment users in your dashboard:
You can set up to 4 properties per request. All values are converted to strings automatically.

Consistent Naming Conventions

Use the same property names across related events:
Consistent naming makes it easier to analyze event sequences in your dashboard.

Track User Journeys

Structure events to understand user flows:
Your dashboard can show where users drop off in multi-step processes.

Session Tracking

Track session duration for engagement analysis:
Use flush: true on session end to ensure the event is sent before the page unloads.

Error and Exception Tracking

Track errors to identify and fix issues:

Page View Tracking

Track page navigation for traffic analysis:

Use User Identification

Identify users to track them across sessions:
Before login, Grain automatically generates and persists a unique anonymous ID for each user.

Preload Remote Config

If you’re using remote config, preload it for faster access:
This ensures configs are available when you need them.

Batch Events Automatically

Grain automatically batches events for efficiency:
For critical events, force immediate send:

Best Practices Summary

1. Descriptive Names: Use clear, specific event names like checkout_completed 2. Rich Properties: Include relevant context in every event 3. Consistent Naming: Use the same property names across similar events 4. Template Events: Use built-in methods like trackPurchase() for consistency 5. User Properties: Set user attributes for segmentation 6. Track Funnels: Structure events to understand user journeys 7. Error Tracking: Log errors with detailed context 8. User Identification: Use identify() or setUserId() to track across sessions 9. Flush Critical Events: Use flush: true for important events like purchases 10. Preload Config: Load remote config early for faster access

Common Patterns

E-commerce Flow

Authentication Flow

Feature Usage

Next Steps

Template Events

Use pre-built event methods

User Properties

Add user attributes for segmentation

E-commerce Guide

Track commerce events effectively

Remote Config

Dynamic configuration management