Grain Tag Types
GrainTagConfig
Configuration options passed toinit().
| Field | Type | Default | Description |
|---|---|---|---|
tenantId | string | required | Your tenant identifier |
apiUrl | string | Production URL | Override the API endpoint |
debug | boolean | false | Enable debug logging |
version | string | — | SDK version override |
consentMode | 'auto' | 'opt-in' | 'opt-out' | 'auto' | Consent handling strategy |
enablePageViews | boolean | true | Auto-track page views |
enableHeatmaps | boolean | true | Track clicks and scroll depth |
enableSnapshots | boolean | true | Capture DOM snapshots |
enableRescue | boolean | true | Enable rescue tracking |
batchSize | number | 50 | Max events per batch |
flushInterval | number | 5000 | Flush interval in milliseconds |
retryAttempts | number | 3 | Number of retry attempts |
GrainTagInstance
The instance returned byinit() and getInstance().
ConsentState
Returned bygrain.consent.status().
| Field | Type | Description |
|---|---|---|
granted | boolean | Whether consent is currently granted |
categories | string[] | Active consent categories (e.g. ['necessary', 'analytics']) |
timestamp | number | Unix timestamp of the consent decision |
version | string | Consent version identifier |
ConsentMode
auto— Starts in cookieless mode, upgrades when consent is grantedopt-in— Requires explicit consent before any tracking beyond necessaryopt-out— Full tracking by default, respects revocation
ConsentCategory
Analytics Web Types
GrainConfig
Configuration options forcreateGrainAnalytics().
GrainEvent
Event structure for tracking.AuthProvider
JWT authentication provider interface.Options Types
SendEventOptions
Options for the Analytics Webtrack() method.
SetPropertyOptions
Options for the Analytics WebsetProperty() method.
RemoteConfigOptions
Options for Analytics Web configuration methods.Response Types
RemoteConfigResponse
API response for configuration fetch.Template Event Types
LoginEventProperties
SignupEventProperties
CheckoutEventProperties
PurchaseEventProperties
AddToCartEventProperties
RemoveFromCartEventProperties
PageViewEventProperties
SearchEventProperties
React Hook Types
UseConfigResult
UseAllConfigsResult
Listener Types
ConfigChangeListener
Importing Types
Grain Tag
Analytics Web
React Hook Types
Next Steps
Core Methods
Event tracking and user management
API Overview
Complete API reference