Event Properties Reference
This document lists all properties automatically tracked by the Grain Analytics SDK and those that developers need to collect manually.Legend
- β Auto-tracked: Automatically collected by the SDK
- π§ Developer-collected: Must be manually tracked by developers
- π Consent-required: Only collected with user consent
Standard Events
page_view
Automatically tracked on every page navigation.
_grain_session_start
Automatically tracked when a new session begins (page load).
_grain_session_end
Automatically tracked when a session ends (page unload/close).
_grain_heartbeat
Automatically tracked at regular intervals to measure engagement.
_grain_consent_granted
Tracked when user grants analytics consent.
Template Events
These events are available via SDK helper methods but require manual triggering.login
Track user authentication.
signup
Track user registration.
purchase
Track completed purchases.
checkout
Track checkout initiation.
purchase event
search
Track search queries.
add_to_cart
Track items added to cart.
remove_from_cart
Track items removed from cart.
Properties same as add_to_cart event
Custom Events
You can track any custom event with your own properties:Automatic Property Enrichment
Important: All custom events (except system events starting with_grain_) are automatically enriched with the following properties:
Always included (no consent required):
- Device Info:
device(Mobile/Tablet/Desktop),browser,os
- UTM Parameters:
utm_source,utm_medium,utm_campaign,utm_term,utm_content(from the current session) - First-Touch Attribution:
first_touch_source,first_touch_medium,first_touch_campaign,first_touch_referrer_category - Session ID:
session_id
Recommended Custom Properties
When tracking custom events, consider including:- Context:
page,section,component - Action details:
action_type,target,value - User state:
is_authenticated,user_plan,user_role - Experiment:
experiment_id,variant - Performance:
duration,load_time
Property Scope
Event-Scoped Properties
Properties that exist on the specific event being tracked. Most properties are event-scoped.User-Scoped Properties
Properties that exist on any event for a given user. In Matrices, you can query by βUser Property (Any Event)β to find users who have logged this property at least once, even if not on the specific event being analyzed. Examples:first_touch_*- Set on session_start, can be queried on any eventutm_*- Set on page_view, can be queried on conversion events- Custom user properties set via
grain.setProperty()
Referrer Categories
The SDK automatically categorizes referrers:- organic: Search engines (Google, Bing, Yahoo, etc.)
- paid: Paid advertising (detected via gclid, fbclid, etc.)
- social: Social media (Facebook, Twitter, LinkedIn, etc.)
- email: Email clients (Gmail, Outlook, etc.)
- referral: Other websites
- direct: No referrer (direct navigation or bookmark)
Browser Detection
Supported browsers:- Chrome
- Firefox
- Safari
- Edge
- Opera
- Unknown (for unrecognized browsers)
OS Detection
Supported operating systems:- Windows
- macOS
- Linux
- Android
- iOS
- Unknown (for unrecognized systems)
Best Practices
- Only log relevant properties: Donβt send null/undefined values
- Use consistent naming: snake_case for property names
- Include context: Add page/section/component for UI events
- Track user flow: Use consistent event names across journeys
- Test attribution: Verify UTM parameters and referrer tracking
- Respect privacy: Only collect necessary data, honor consent
Configuration
Disable Auto-Properties
To disable automatic property collection:Strip Query Parameters
To remove query params from page URLs:Property Whitelist
To limit which properties can be tracked:Need Help?
- Documentation: docs.grainql.com
- Dashboard: grainql.com/dashboard
- Issues: GitHub Issues
- Email: support@grainql.com