Event System
The Glood SDK’s event system automatically transforms Shopify Analytics events into Glood pixel data and transmits them to configured endpoints with full privacy compliance.Architecture Overview
The event system follows this flow:Components
- Event Subscription - Automatically subscribes to Shopify Analytics events
- Event Distribution - Routes events to interested apps
- Data Transformation - Converts Shopify data to Glood pixel format
- Consent Checking - Verifies customer privacy permissions
- Pixel Queue - Manages immediate transmission with retry logic
- Error Handling - Comprehensive error handling and logging
Event Types
The SDK tracks these Shopify Analytics events:Core Events
Event Type | Description | Triggered When |
---|---|---|
page_viewed | Page navigation | User visits any page |
product_viewed | Product page view | User views product details |
collection_viewed | Collection page view | User browses product collections |
cart_viewed | Shopping cart view | User opens shopping cart |
search_submitted | Search query | User performs search |
Commerce Events
Event Type | Description | Triggered When |
---|---|---|
product_added_to_cart | Add to cart | User adds product to cart |
product_removed_from_cart | Remove from cart | User removes product from cart |
custom_promotion_viewed | Promotion view | User sees promotional content |
Event Transformation
The SDK transforms Shopify Analytics events into Glood pixel format using sophisticated data transformation:Shopify → Glood Transformation
Event-Specific Transformations
Product Viewed
Search Submitted
Cart Viewed
Pixel Transmission
Immediate Transmission
The SDK uses immediate pixel transmission with retry logic:Retry Strategy
- Retry Delays:
[1000, 2000, 4000, 8000]
milliseconds - Max Retries: 4 attempts total (initial + 3 retries)
- Backoff: Exponential backoff strategy
- Error Logging: Comprehensive error logging with debug details
Network Resilience
Consent Management
Automatic Consent Checking
The SDK automatically checks customer consent before sending pixels:Consent Requirements by App
App | Default Consent Requirements | Description |
---|---|---|
Recommendations | ['analytics', 'marketing'] | Analytics for tracking + marketing for personalization |
Search | ['analytics'] | Only analytics for search improvement |
Wishlist | ['analytics', 'preferences'] | Analytics + preferences for wishlist personalization |
Privacy Scenarios
Session & Identity Management
Client ID Generation
Session Management
Browser Context
Debug Logging
Debug Mode Events
Enable debug mode to see detailed event flow:Debug Log Examples
Error Debug Logs
Performance Considerations
Event Deduplication
Events are subscribed to only once per event type:Immediate Transmission
No batching delays - events are sent immediately:Memory Management
- No accumulation - Events are not stored in memory
- Immediate processing - Events are transformed and sent immediately
- Cleanup - Event handlers are properly cleaned up on unmount
Error Handling
Network Errors
Consent Errors
Transformation Errors
Custom Event Handling
Accessing Raw Events
Custom Data Enrichment
Best Practices
1. Debug Mode in Development
2. Monitor Network Errors
3. Validate Consent Configuration
4. Test Event Flow
See Also
- App Modules - App configuration and event subscriptions
- Components - GloodProvider setup
- Utilities - Consent and data transformation utilities
- Content Security Policy - CSP configuration for pixel transmission