Glood Hydrogen SDK
The Glood Hydrogen SDK is a TypeScript-first library designed specifically for seamless integration between Gloodβs e-commerce platform and Shopify Hydrogen storefronts. It provides React components, hooks, and utilities optimized for the Hydrogen framework.Key Features
π Hydrogen-Optimized - Built specifically for Shopify Hydrogen with SSR support π― TypeScript First - Complete type safety with excellent developer experience β‘ Performance Focused - Tree-shakeable exports and optimized pixel tracking π§ Zero Configuration - Works out of the box with sensible defaults π‘οΈ Privacy Compliant - GDPR/CCPA compliant with automatic consent handling π¦ Lightweight - Minimal bundle impact with selective importsQuick Start
1. Installation
2. Basic Setup
Add your Glood API key to environment variables:3. Thatβs It! π
No additional setup required. The SDK automatically:- β Tracks user interactions via Shopify Analytics
- β Sends pixel events to Glood endpoints
- β Respects customer privacy settings
- β Provides debug logging in development
Why loaderData is Required
TheloaderData
prop is mandatory and enables Glood apps to:
- Access route-specific data from Hydrogen loaders for enhanced context
- Enhance analytics events with additional page-specific information
- Provide personalized recommendations based on current page data
- Optimize search results using page context and user behavior
useLoaderData()
to the GloodProvider
component.
Architecture Overview
React Context Integration
The SDK uses React Context to provide the Glood client throughout your application:Event Flow
- Shopify Analytics β Automatically tracks user interactions
- GloodProvider β Subscribes to analytics events via
useAnalytics()
- Event Transformation β Converts Shopify events to Glood pixel format
- Consent Checking β Verifies customer privacy permissions
- Pixel Transmission β Sends events to configured Glood endpoints
App Module System
The SDK follows a modular architecture with three core apps:- Recommendations (
recommendations()
) - Product recommendations and personalization - Search (
search()
) - Search functionality and analytics - Wishlist (
wishlist()
) - Wishlist management and tracking
Configuration Options
Basic Configuration (Recommended)
- Zero configuration beyond API key and domain
- Automatic default endpoints for all apps
- Pixel tracking enabled by default with appropriate consent requirements
- Perfect for getting started quickly
Advanced Configuration
- Custom endpoint URLs for different environments
- Granular pixel tracking control per app
- Custom consent requirements for privacy compliance
- Environment-specific configurations
Privacy & Compliance
The SDK provides automatic privacy compliance through Shopifyβs Customer Privacy API:Default Consent Requirements
- Recommendations:
['analytics', 'marketing']
- Analytics and marketing consent - Search:
['analytics']
- Only analytics consent required - Wishlist:
['analytics', 'preferences']
- Analytics and preferences consent
How Consent Works
- User visits site and sees Shopify privacy banner
- User grants specific consent types through the privacy interface
- Events are tracked by Shopify Analytics as usual
- For each event, Glood checks if user has granted all required consents for that app
- Only if all consents are granted, pixel data is sent to Glood
Default Endpoints
When using basic configuration, these endpoints are used automatically:Recommendations
- Main:
https://storefront.glood.ai
- Product recommendations API - Pixel:
https://events.glood.ai
- Analytics events tracking
Search
- Main:
https://s-s.glood.ai
- Search functionality API - Pixel:
https://s-pixel.glood.ai
- Search analytics tracking
Wishlist
- Main:
https://w-s.glood.ai
- Wishlist management API - Pixel:
https://w-pixel.glood.ai
- Wishlist analytics tracking
Content Security Policy Setup
To enable pixel tracking, add Glood domains to your Content Security Policy:Debug Mode
Enable debug mode to see detailed logging during development:- Event subscriptions setup
- Received analytics events
- Consent checking results
- Pixel transmission status
- Error details
Next Steps
- Installation Guide - Detailed setup instructions
- Configuration - Basic and advanced configuration options
- API Reference - Complete API documentation
- Examples - Implementation examples and patterns
- Content Security Policy - CSP configuration guide
Requirements
- Node.js 18+
- React 18+
- Shopify Hydrogen 2024.10.1+
- TypeScript 5.4+ (recommended)
Support
- π API Reference
- π¬ GitHub Discussions
- π Issues