Configuration Guide
The Glood Hydrogen SDK supports both basic and advanced configuration patterns to fit different use cases and environments.Configuration Overview
The SDK follows a zero-configuration principle with sensible defaults, while providing full customization options for advanced use cases.Configuration Hierarchy
- Basic Configuration - Only API key and domain required
- Client-Level App Config - Override recommendations settings in the
apps.recommendationsblock ofcreateGlood(...) - Environment Variables - External configuration management
API Version
createGlood accepts an optional numeric version that selects the headless API version. It defaults to 3.
3(default) - The full headless suite: session init, sections, events, and all recommendation variants. Authenticates with anAuthorization: Bearer <apiKey>header plus the shop header.2(legacy) - Recommendations only. Authenticates by shop header alone (no bearer token) and does not support session init or the events suite.
createGlood throws if version is anything other than 2 or 3. Leave it unset (or 3) unless you specifically need the legacy v2 behavior.Basic Configuration
Minimal Setup
The simplest configuration requires only your API key and Shopify domain:- ✅ Recommendations enabled with default endpoint
- ✅ Pixel tracking enabled
- ✅ Default consent requirements
- ✅ Automatic event subscriptions
- ✅ Production-ready configuration
Basic with Debug Mode
Enable debug logging for development:Advanced Configuration
Client-Level App Configuration
Override the recommendations app settings in the main client configuration:The
recommendations() module factory takes no arguments. Configure the app entirely through the apps.recommendations block of createGlood(...), then register it with .use(recommendations()).Search App Configuration
The search app is a v1 headless API on its own host (https://search.glood.ai), independent
of the client’s global version. Register it with .use(search()) and configure it through
the apps.search block:
Search’s default consent is analytics only (unlike recommendations, which also requires
marketing). Search’s
apiVersion is fixed at 1 and is not affected by the client’s
version — so you can run recommendations (v3) and search (v1) on the same client.Edge vs. non-edge routing (controlEndpoint)
The search app talks to two hosts. endpoint is the main host — used for init, config,
instantSearch, filters, filter aggregations, and search. controlEndpoint is the
non-edge (control-plane) host — used only for image search and event ingestion, which
cannot be served by a regional edge (image search needs the vision/embedding pipeline; events are
ingested centrally).
controlEndpoint defaults to the non-edge host, so if you point endpoint at a regional edge,
image search and events automatically stay on the control plane — you only override one field:
Set
controlEndpoint explicitly only when your control plane isn’t the default host (e.g. a local
or self-hosted deployment). In production, leave it unset and it resolves to the non-edge host.Narrowing search events
Thesearch() factory optionally narrows which Shopify standard events are forwarded to the
search backend (default: all events):
Where Events Are Sent
Analytics and attribution events are routed by the app’s API version off the app’s events endpoint — there is no separate events host.- v3 (recommendations) →
POST {endpoint}/api/storefront/v3/headless/events, with headersAuthorization: Bearer <apiKey>andx-shop. - v1 (search) →
POST {controlEndpoint}/api/storefront/v1/headless/events, with headersAuthorization: Bearer <apiKey>andx-shop. - v2 (legacy recommendations) →
POST {endpoint}/api/storefront/event, with headerx-shop-myshopify-domain(legacy payload).
You do not configure an events endpoint directly. For recommendations it is derived from the app’s
endpoint; for search it is derived from controlEndpoint (the non-edge host), so events keep
flowing to the control plane even when endpoint points at a regional edge.Environment-Specific Configuration
Multi-Environment Setup
Configure different settings for different environments:Environment Variables
Use environment variables for external configuration:Privacy & Consent Configuration
Default Consent Requirements
The recommendations app requires both analytics and marketing consent by default, since personalization relies on marketing signals:Custom Consent Configuration
Customize consent requirements for compliance:Consent Scenarios
Different configurations for different privacy requirements:Event Subscription Configuration
Default Event Subscriptions
By default, the recommendations app subscribes to all relevant events:Custom Event Subscriptions
Limit events by settingsubscribedEvents in the apps.recommendations block:
Performance Configuration
Development Optimization
Optimize for development experience:Production Optimization
Optimize for production performance:Testing Configuration
In tests, point the recommendationsendpoint at a mock server and set pixel.enabled: false so no external requests are made:
Configuration Validation
createGlood validates apiKey, myShopifyDomain and version (must be 2 or 3) and throws on invalid input, so no separate validation step is needed.
Best Practices
1. Environment-Based Configuration
Use different configurations for different environments:2. Gradual Rollout
Start with minimal configuration and gradually add custom settings:3. Privacy-First Configuration
Design configurations with privacy in mind:4. Configuration Documentation
Document your configuration choices:Configuration Examples
See the Examples section for complete configuration examples:- Basic Setup - Simple configuration
- Recommendations - Fetching and displaying recommendation sections
See Also
- Installation Guide - Getting started
- API Reference - Complete API documentation
- Content Security Policy - CSP configuration
- Types Reference - TypeScript interfaces