Skip to main content

App Modules

App modules provide modular functionality for Glood features. Each module is registered with the Glood client via .use().

Overview

The SDK ships two app modules:
  • recommendations() - Product recommendations and personalization (v3)
  • search() - AI search & discovery (v1)
The module follows this architecture:
  • Main Endpoint - API endpoint for app features and functionality
  • Pixel Endpoint - Separate endpoint for analytics tracking
  • Event Subscriptions - Shopify Analytics events the app listens to
  • Consent Requirements - Privacy consent types required for pixel tracking

recommendations()

Enables product recommendations and personalization features.

Signature

Default Configuration

Basic Usage

Custom Configuration

Endpoints and pixel settings are customized at the client level via the apps.recommendations config block:

Tracked Events

The recommendations app subscribes to these Shopify Analytics events by default:

RecommendationsApp Methods

Get the app instance from the client and call its methods to fetch recommendations and record attribution.
Methods marked v3 require a version-3 client (the default). Calling a v3-only method such as getInit on a version: 2 client throws.

getSections()

Fetch recommendation sections (with full product data) for the current visitor. v3.

getInit()

Bootstrap a headless session — server-issued ids, visitor history, shop config, and storefront token. v3 only (throws for v2 clients).

getRecommendations()

Fetch anchor-based recommendations. Version-aware — uses the client’s configured API version. v3 returns RecommendationsResponse; v2 returns the legacy V2RecommendationsResponse shape.

getAutomaticRecommendations()

Fetch single-anchor, cursor-paginated similar-products recommendations. v3.

getTopRecommendations()

Fetch anchorless, strategy-ranked, faceted catalog recommendations. v3.

sendEvent()

Send a single interaction event to the headless events endpoint. v3.

Attribution Tracking

The following helpers emit glood:section:* custom events to attribute interactions back to a rendered section. Each takes a SectionTrack and returns void.
Enables AI search & discovery — instant search, full search results, filters, and image search. Search is a v1 headless API on its own host, independent of the client’s global version.

Signature

options.events narrows which Shopify standard events are forwarded to the search backend (default: all events).

Default Configuration

Basic Usage

SearchApp Methods

Get the app instance and call its methods:
Plus the attribution helpers trackSearch, trackResultView, trackResultClick, trackAddToCart, trackFilter — each takes a SearchTrack and emits a glood:search:* custom event. See the Search API Reference for full details.

App Configuration Interface

The recommendations app config structure:
Available consent types for pixel tracking:

Event Types

Available event types for subscriptions:

Client Override Configuration

The recommendations app configuration can be overridden at the client level:

Accessing Apps at Runtime

Get app instances from the client:

Best Practices

1. Privacy Compliance

Set appropriate consent requirements:

2. Performance Optimization

Disable pixel tracking in development:

See Also