> ## Documentation Index
> Fetch the complete documentation index at: https://docs.glood.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Signatures & Parameters

> Argument structure for every hook, component, and function exported by @glood/hydrogen, in table form.

A quick, table-first reference for the argument structure of everything exported from `@glood/hydrogen`. Object-typed arguments (e.g. `GloodConfig`, `GetSectionsParams`) are expanded under [Parameter object shapes](#parameter-object-shapes); full response types live in [Types](/for-developers/glood-hydrogen-sdk/api-reference/types).

<Note>
  All headless calls run against API `version` (`2 | 3`, default `3`). Functions marked **v3-only** throw when called on a v2 client.
</Note>

## Client

### createGlood(config)

```typescript theme={null}
function createGlood(config: GloodConfig): GloodClient
```

| Argument | Type                          | Required | Description                                                                                         |
| -------- | ----------------------------- | -------- | --------------------------------------------------------------------------------------------------- |
| `config` | [`GloodConfig`](#gloodconfig) | Yes      | Client configuration. Throws if `apiKey`/`myShopifyDomain` are missing or `version` is not `2`/`3`. |

**Returns:** `GloodClient`

### GloodClient methods

| Method                    | Arguments                             | Returns                                                                |
| ------------------------- | ------------------------------------- | ---------------------------------------------------------------------- |
| `use(appModuleOrFactory)` | `appModuleOrFactory: GloodAppModule`  | `GloodClient` (chainable)                                              |
| `getEnabledApps()`        | —                                     | `GloodApp[]`                                                           |
| `getApp(name)`            | `name: AppName` (`'recommendations'`) | `GloodApp \| undefined`                                                |
| `getInitData()`           | —                                     | `InitResponse \| null` (saved `/v3/headless/init` response; read-only) |
| `setInitData(data)`       | `data: InitResponse \| null`          | `void` (used internally by `runHeadlessInit`)                          |

## App module

### recommendations()

```typescript theme={null}
function recommendations(): GloodAppModule
```

Takes no arguments. Pass to `client.use(recommendations())`.

### RecommendationsApp methods

Obtain the app with `client.getApp('recommendations')`.

| Method                                | Arguments                                                                     | Returns                                                         | Notes                       |
| ------------------------------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------- |
| `getSections(params)`                 | `params:` [`GetSectionsParams`](#getsectionsparams)                           | `Promise<SectionsResponse>`                                     | v3                          |
| `getInit(params?)`                    | `params?:` [`InitParams`](#initparams)                                        | `Promise<InitResponse>`                                         | **v3-only**                 |
| `getRecommendations(params)`          | `params:` [`RecommendationsParams`](#recommendationsparams)                   | `Promise<RecommendationsResponse \| V2RecommendationsResponse>` | version-aware               |
| `getAutomaticRecommendations(params)` | `params:` [`AutomaticRecommendationsParams`](#automaticrecommendationsparams) | `Promise<AutomaticRecommendationsResponse>`                     | **v3-only**                 |
| `getTopRecommendations(params)`       | `params:` [`TopRecommendationsParams`](#toprecommendationsparams)             | `Promise<TopRecommendationsResponse>`                           | **v3-only**                 |
| `sendEvent(params)`                   | `params:` [`HeadlessEventParams`](#headlesseventparams)                       | `Promise<HeadlessEventResponse>`                                | **v3-only**                 |
| `trackRender(track)`                  | `track:` [`SectionTrack`](#sectiontrack)                                      | `void`                                                          | glood:section:render        |
| `trackView(track)`                    | `track:` [`SectionTrack`](#sectiontrack)                                      | `void`                                                          | glood:section:view          |
| `trackClick(track)`                   | `track:` [`SectionTrack`](#sectiontrack)                                      | `void`                                                          | glood:section:click         |
| `trackAddToCart(track)`               | `track:` [`SectionTrack`](#sectiontrack)                                      | `void`                                                          | glood:section:add\_to\_cart |

### search()

```typescript theme={null}
function search(options?: { events?: EventType[] }): GloodAppModule
```

`options.events` narrows the forwarded standard events (default: all). Pass to
`client.use(search())`. Search is pinned to **v1** regardless of the client version.

### SearchApp methods

Obtain the app with `client.getApp('search')`.

| Method                    | Arguments                                               | Returns                          | Notes                                |
| ------------------------- | ------------------------------------------------------- | -------------------------------- | ------------------------------------ |
| `init(params?)`           | `params?:` [`SearchInitParams`](#searchinitparams)      | `Promise<SearchInitResponse>`    | v1; auto-run once by `GloodProvider` |
| `config(params?)`         | `params?:` [`SearchConfigParams`](#searchconfigparams)  | `Promise<SearchConfigResponse>`  | v1                                   |
| `instantSearch(params)`   | `params:` [`InstantSearchParams`](#instantsearchparams) | `Promise<InstantSearchResponse>` | v1                                   |
| `filters(params?)`        | `params?:` [`FiltersParams`](#filtersparams)            | `Promise<FiltersResponse>`       | v1                                   |
| `search(params?)`         | `params?:` [`SearchParams`](#searchparams)              | `Promise<SearchResponse>`        | v1                                   |
| `imageSearch(params)`     | `params:` [`ImageSearchParams`](#imagesearchparams)     | `Promise<ImageSearchResponse>`   | v1                                   |
| `trackSearch(track)`      | `track:` [`SearchTrack`](#searchtrack)                  | `void`                           | glood:instant\_search\_triggered     |
| `trackResultView(track)`  | `track:` [`SearchTrack`](#searchtrack)                  | `void`                           | glood:search\_result\_rendered       |
| `trackResultClick(track)` | `track:` [`SearchTrack`](#searchtrack)                  | `void`                           | glood:search\_result\_clicked        |
| `trackAddToCart(track)`   | `track:` [`SearchTrack`](#searchtrack)                  | `void`                           | glood:search:add\_to\_cart           |
| `trackFilter(track)`      | `track:` [`SearchTrack`](#searchtrack)                  | `void`                           | glood:search\_filter\_updated        |

## Components & hooks

### GloodProvider(props)

```typescript theme={null}
function GloodProvider(props: GloodProviderProps): React.ReactElement
```

| Prop         | Type          | Required | Description                              |
| ------------ | ------------- | -------- | ---------------------------------------- |
| `client`     | `GloodClient` | Yes      | The client from `createGlood()`.         |
| `loaderData` | `any`         | Yes      | Root loader data (shop/consent context). |
| `children`   | `ReactNode`   | Yes      | App tree.                                |

Subscribes to Shopify analytics and fires `/v3/headless/init` on mount (v3).

### Hooks

| Hook                                   | Arguments                                                                               | Returns                                                                                  |
| -------------------------------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `useGloodAnalytics()`                  | —                                                                                       | `GloodClient \| null`                                                                    |
| `useGloodInit()`                       | —                                                                                       | `InitResponse \| null` (v3 init response; `null` until resolved / for v2)                |
| `useGloodInitReady()`                  | —                                                                                       | `boolean` (true once page-load init has settled)                                         |
| `useRecommendations(params, options?)` | `params:` [`GetSectionsParams`](#getsectionsparams), `options?: { skip?: boolean }`     | `UseRecommendationsResult`                                                               |
| `useSearch(params, options?)`          | `params:` [`SearchParams`](#searchparams), `options?: { skip?: boolean }`               | `UseSearchResult`                                                                        |
| `useInstantSearch(params, options?)`   | `params:` [`InstantSearchParams`](#instantsearchparams), `options?: { skip?: boolean }` | `UseInstantSearchResult`                                                                 |
| `useSearchConfig(params?, options?)`   | `params?:` [`SearchConfigParams`](#searchconfigparams), `options?: { skip?: boolean }`  | `UseSearchConfigResult`                                                                  |
| `useSearchInit()`                      | —                                                                                       | `SearchInitResponse \| null` (search session bootstrap; `null` until resolved)           |
| `useSearchInitReady()`                 | —                                                                                       | `boolean` (true once search init has settled; `useSearch`/`useInstantSearch` gate on it) |

`UseRecommendationsResult` = `{ sections, data, loading, error, refetch, trackRender, trackView, trackClick, trackAddToCart }`.

`UseSearchResult` = `{ products, data, loading, error, refetch, trackSearch, trackResultView, trackResultClick, trackAddToCart, trackFilter }`.

`UseInstantSearchResult` = `{ data, products, suggestions, collections, pages, loading, error, refetch }`.

`UseSearchConfigResult` = `{ config, loading, error, refetch }`.

## Standalone functions

All take `options:` [`HeadlessRequestOptions`](#headlessrequestoptions) as the first argument.

| Function                                         | Arguments                                                                     | Returns                                                         | Notes               |
| ------------------------------------------------ | ----------------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------- |
| `fetchRecommendationSections(options, params)`   | `params:` [`GetSectionsParams`](#getsectionsparams)                           | `Promise<SectionsResponse>`                                     | v3                  |
| `fetchHeadlessInit(options, params?)`            | `params?:` [`InitParams`](#initparams)                                        | `Promise<InitResponse>`                                         | **v3-only**         |
| `sendHeadlessEvent(options, params)`             | `params:` [`HeadlessEventParams`](#headlesseventparams)                       | `Promise<HeadlessEventResponse>`                                | **v3-only**         |
| `fetchRecommendations(options, params)`          | `params:` [`RecommendationsParams`](#recommendationsparams)                   | `Promise<RecommendationsResponse \| V2RecommendationsResponse>` | version-aware       |
| `fetchV3Recommendations(options, params)`        | `params:` [`RecommendationsParams`](#recommendationsparams)                   | `Promise<RecommendationsResponse>`                              | v3                  |
| `fetchV2Recommendations(options, params)`        | `params:` [`V2RecommendationsParams`](#v2recommendationsparams)               | `Promise<V2RecommendationsResponse>`                            | v2                  |
| `fetchAutomaticRecommendations(options, params)` | `params:` [`AutomaticRecommendationsParams`](#automaticrecommendationsparams) | `Promise<AutomaticRecommendationsResponse>`                     | **v3-only**         |
| `fetchTopRecommendations(options, params)`       | `params:` [`TopRecommendationsParams`](#toprecommendationsparams)             | `Promise<TopRecommendationsResponse>`                           | **v3-only**         |
| `headlessRequest(resource, body, options)`       | `resource: string`, `body: Record<string, any>`                               | `Promise<T>`                                                    | low-level POST      |
| `runHeadlessInit(client)`                        | `client: GloodClient`                                                         | `Promise<InitResponse \| null>`                                 | no-op/`null` for v2 |
| `fetchSearchInit(options, params?)`              | `params?:` [`SearchInitParams`](#searchinitparams)                            | `Promise<SearchInitResponse>`                                   | search v1           |
| `fetchSearchConfig(options, params?)`            | `params?:` [`SearchConfigParams`](#searchconfigparams)                        | `Promise<SearchConfigResponse>`                                 | search v1           |
| `fetchInstantSearch(options, params)`            | `params:` [`InstantSearchParams`](#instantsearchparams)                       | `Promise<InstantSearchResponse>`                                | search v1           |
| `fetchFilters(options, params?)`                 | `params?:` [`FiltersParams`](#filtersparams)                                  | `Promise<FiltersResponse>`                                      | search v1           |
| `fetchFilterAggregations(options, params?)`      | `params?:` [`FilterAggregationsParams`](#filteraggregationsparams)            | `Promise<FilterAggregationsResponse>`                           | search v1           |
| `fetchSearchResults(options, params?)`           | `params?:` [`SearchParams`](#searchparams)                                    | `Promise<SearchResponse>`                                       | search v1           |
| `fetchImageSearch(options, params)`              | `params:` [`ImageSearchParams`](#imagesearchparams)                           | `Promise<ImageSearchResponse>`                                  | search v1           |
| `sendSearchEvent(options, params)`               | `params:` [`HeadlessEventParams`](#headlesseventparams)                       | `Promise<HeadlessEventResponse>`                                | search v1           |

<Note>
  Search fetchers take `options: FetchSearchOptions` (the same `HeadlessRequestOptions`) and are
  pinned to v1 internally, defaulting `endpoint` to `https://search.glood.ai`.
</Note>

## Utilities & errors

| Export                                                | Arguments                                                                               | Returns                              |
| ----------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------ |
| `checkConsent(requiredConsents, canTrack, analytics)` | `requiredConsents: readonly ConsentType[]`, `canTrack: () => boolean`, `analytics: any` | `boolean`                            |
| `getPixelQueue(debug?)`                               | `debug?: boolean` (default `false`)                                                     | `PixelQueue`                         |
| `resetPixelQueue()`                                   | —                                                                                       | `void`                               |
| `new GloodApiError(message, status, body)`            | `message: string`, `status: number`, `body: unknown`                                    | `GloodApiError` (`.status`, `.body`) |

## Parameter object shapes

### GloodConfig

| Field             | Type                                             | Required | Default  | Description                         |
| ----------------- | ------------------------------------------------ | -------- | -------- | ----------------------------------- |
| `apiKey`          | `string`                                         | Yes      | —        | Glood storefront token (`gl_sf_*`). |
| `myShopifyDomain` | `string`                                         | Yes      | —        | `store-name.myshopify.com`.         |
| `version`         | `2 \| 3`                                         | No       | `3`      | Headless API version.               |
| `apps`            | `{ recommendations?: RecommendationsAppConfig }` | No       | defaults | Per-app config.                     |
| `debug`           | `boolean`                                        | No       | `false`  | Debug logging.                      |
| `settings`        | `Record<string, any>`                            | No       | —        | Passthrough settings.               |

### HeadlessRequestOptions

| Field             | Type      | Required | Default                       | Description                      |
| ----------------- | --------- | -------- | ----------------------------- | -------------------------------- |
| `apiKey`          | `string`  | Yes (v3) | —                             | Storefront token; bearer for v3. |
| `myShopifyDomain` | `string`  | Yes      | —                             | Sent as `x-shop`.                |
| `endpoint`        | `string`  | No       | `https://storefront.glood.ai` | Endpoint override.               |
| `version`         | `2 \| 3`  | No       | `3`                           | API version.                     |
| `debug`           | `boolean` | No       | `false`                       | Log request/response.            |

### GetSectionsParams

| Field            | Type                      | Required | Description                                        |
| ---------------- | ------------------------- | -------- | -------------------------------------------------- |
| `pageType`       | `PageType`                | Yes      | Page the visitor is on.                            |
| `pageUrl`        | `string`                  | No       | Defaults to `window.location.href` in the browser. |
| `locale`         | `string`                  | No       | Defaults to `navigator.language` in the browser.   |
| `productId`      | `string \| number`        | No       | Numeric Shopify product id (product pages).        |
| `cartProductIds` | `Array<string \| number>` | No       | Numeric ids in cart.                               |
| `sections`       | `number[]`                | No       | Specific section ids (empty = all).                |
| `clientId`       | `string`                  | No       | Defaults to the `_glood_client_id` cookie.         |
| `userId`         | `string`                  | No       | Defaults to the init `_glood_user_id` cookie.      |
| `customerId`     | `string`                  | No       | Shopify customer id.                               |
| `market`         | `string`                  | No       | Market id.                                         |
| `currency`       | `string`                  | No       | Currency code.                                     |
| `cartValue`      | `string`                  | No       | Cart total.                                        |
| `collection`     | `number`                  | No       | Numeric collection id.                             |
| `qs`             | `string`                  | No       | Query string for experience assignment.            |
| `preview`        | `boolean`                 | No       | Include disabled sections.                         |

### InitParams

| Field        | Type       | Required | Description                                         |
| ------------ | ---------- | -------- | --------------------------------------------------- |
| `userId`     | `string`   | No       | Replays a persisted visitor id (returning visitor). |
| `clientId`   | `string`   | No       | Defaults to the `_glood_client_id` cookie.          |
| `customerId` | `string`   | No       | Shopify customer id.                                |
| `pageType`   | `PageType` | No       | Current page type.                                  |
| `pageUrl`    | `string`   | No       | Defaults to `window.location.href`.                 |

### RecommendationQuery

| Field                | Type                      | Required | Description                                                                                                                  |
| -------------------- | ------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `id`                 | `string`                  | Yes      | Result key in the response.                                                                                                  |
| `recommendationType` | `string`                  | Yes      | One of [`RecommendationType`](#recommendationtype-recommendationtype) — commonly `'similar_products'` / `'bought_together'`. |
| `productIds`         | `Array<string \| number>` | Yes      | Anchor product ids (v3: up to 10).                                                                                           |
| `maxRecommendations` | `number`                  | No       | Max results.                                                                                                                 |
| `creationType`       | `string`                  | No       | One of [`CreationType`](#creationtype-creationtype): `'manual'` \| `'automatic'`.                                            |
| `view`               | `RecommendationView`      | Yes      | `'product_details'` or `'product_ids'`.                                                                                      |

### RecommendationsParams

| Field        | Type                                            | Required | Description          |
| ------------ | ----------------------------------------------- | -------- | -------------------- |
| `queries`    | [`RecommendationQuery[]`](#recommendationquery) | Yes      | Up to 5 (v3).        |
| `clientId`   | `string`                                        | No       | Visitor client id.   |
| `userId`     | `string`                                        | No       | Visitor user id.     |
| `customerId` | `string`                                        | No       | Shopify customer id. |

### V2RecommendationsParams

| Field     | Type                                            | Required | Description                    |
| --------- | ----------------------------------------------- | -------- | ------------------------------ |
| `queries` | [`RecommendationQuery[]`](#recommendationquery) | Yes      | `similar_products` only on v2. |

### AutomaticRecommendationsParams

| Field                | Type                                          | Required | Description                             |
| -------------------- | --------------------------------------------- | -------- | --------------------------------------- |
| `productIds`         | `number[]`                                    | Yes      | Anchor product ids.                     |
| `view`               | `RecommendationView`                          | Yes      | `'product_details'` or `'product_ids'`. |
| `recommendationType` | `'similar_products'`                          | No       | Only value supported.                   |
| `maxRecommendations` | `number`                                      | No       | Max results.                            |
| `filter`             | `Record<string, any>`                         | No       | Vendor/tag/variant filters.             |
| `pagination`         | `{ cursor?: string \| null; limit?: number }` | No       | Cursor pagination (limit default 12).   |

### TopRecommendationsParams

| Field             | Type                                                                       | Required | Description                                                    |
| ----------------- | -------------------------------------------------------------------------- | -------- | -------------------------------------------------------------- |
| `strategy`        | `TopStrategy`                                                              | Yes      | `'BESTSELLERS'` \| `'NEW_ARRIVALS'` — **uppercase**.           |
| `view`            | `RecommendationView`                                                       | Yes      | `'product_details'` or `'product_ids'`.                        |
| `strategyOptions` | `{ salesTimePeriod?: 7 \| 15 \| 30; bestsellerMetric?: BestsellerMetric }` | No       | `bestsellerMetric`: `'revenue'` \| `'quantity'` \| `'orders'`. |
| `query`           | `string`                                                                   | No       | Full-text catalog search.                                      |
| `filter`          | `Record<string, any>`                                                      | No       | Vendor/tag/price/etc. filters.                                 |
| `facets`          | `TopFacet[]`                                                               | No       | `'vendor' \| 'product_type' \| 'tag' \| 'price'`.              |
| `pagination`      | `{ cursor?: string \| null; limit?: number }`                              | No       | Cursor pagination (limit default 24, max 100).                 |

### HeadlessEventParams

| Field        | Type                                                | Required | Description                                                          |
| ------------ | --------------------------------------------------- | -------- | -------------------------------------------------------------------- |
| `event`      | `{ id, name, type, timestamp, data?, customData? }` | Yes      | `type` is `'standard' \| 'custom'`; `timestamp` ISO, within ±2 days. |
| `channel`    | `HeadlessEventChannel`                              | No       | `'mobile' \| 'headless' \| 'hydrogen'` (default `'hydrogen'`).       |
| `sessionId`  | `string`                                            | No       | Defaults to the session cookie (server requires it).                 |
| `clientId`   | `string`                                            | No       | At least one of `clientId`/`userId` required.                        |
| `userId`     | `string`                                            | No       | See above.                                                           |
| `customerId` | `string`                                            | No       | Shopify customer id.                                                 |
| `experience` | `string \| null`                                    | No       | Assigned experience id.                                              |
| `pageType`   | `string`                                            | No       | Page type.                                                           |
| `pageUrl`    | `string`                                            | No       | Page URL.                                                            |

Additional fields (e.g. `cart`, `customer`, `customer_privacy`, `device`) are passed through in the API's snake\_case wire format.

### SectionTrack

| Field            | Type                                         | Required | Description                                                 |
| ---------------- | -------------------------------------------- | -------- | ----------------------------------------------------------- |
| `section`        | `string`                                     | No       | Glood section id.                                           |
| `sectionServeId` | `string`                                     | No       | `section_serve_id` from the sections response.              |
| `requestId`      | `string`                                     | No       | `request_id` from the sections response.                    |
| `page`           | `string`                                     | No       | Page type of the interaction.                               |
| `parent`         | `{ productId?: string; variantId?: string }` | No       | Context product (e.g. the PDP product).                     |
| `products`       | `SectionTrackProduct[]`                      | No       | Products involved (`{ productId, variantId?, quantity? }`). |

### SearchInitParams

All optional. In the browser `visitorId` / `clientId` default from the Glood cookies.

| Field        | Type     | Required | Description                                                 |
| ------------ | -------- | -------- | ----------------------------------------------------------- |
| `pageType`   | `string` | No       | Page the session starts on (context only).                  |
| `pageUrl`    | `string` | No       | Full URL of that page.                                      |
| `locale`     | `string` | No       | BCP-47 locale (default `en-US`).                            |
| `market`     | `number` | No       | Shopify market id.                                          |
| `visitorId`  | `string` | No       | Anonymous visitor UID; defaults from cookie in the browser. |
| `clientId`   | `string` | No       | Per-session/device id; defaults from cookie in the browser. |
| `customerId` | `string` | No       | Shopify customer id (logged-in shoppers).                   |

### SearchConfigParams

| Field        | Type      | Required | Description                                      |
| ------------ | --------- | -------- | ------------------------------------------------ |
| `locale`     | `string`  | No       | BCP-47 locale (default `en-US`).                 |
| `market`     | `number`  | No       | Shopify market id.                               |
| `theme`      | `number`  | No       | Theme id (parity only; no templates rendered).   |
| `targetPage` | `string`  | No       | `search` \| `collection`.                        |
| `targetId`   | `number`  | No       | Target object id (e.g. collection id).           |
| `visitorId`  | `string`  | No       | Defaults from the visitor cookie in the browser. |
| `skipCache`  | `boolean` | No       | Bypass the cached config.                        |

### InstantSearchParams

| Field                                   | Type                                                    | Required | Description                                                                                                         |
| --------------------------------------- | ------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
| `query`                                 | `string`                                                | Yes      | Search term (may be `""`).                                                                                          |
| `locale`                                | `string`                                                | No       | BCP-47 locale.                                                                                                      |
| `market`                                | `number`                                                | No       | Shopify market id.                                                                                                  |
| `limit`                                 | `number`                                                | No       | Per-type result limit (1–100).                                                                                      |
| `objects`                               | [`InstantSearchObject[]`](#instantsearchobject-objects) | No       | Result blocks to return.                                                                                            |
| `view`                                  | [`SearchView`](#searchview-view)                        | No       | `product_details` (default) \| `product_ids`.                                                                       |
| `visitorId` / `clientId` / `customerId` | `string`                                                | No       | Identity triple (defaults from cookies in the browser).                                                             |
| `trending`                              | `{ type?, period?, category?, limit? }`                 | No       | Empty-state trending options (`type`: `searches` \| `products` \| `all`; `period`: `1h` \| `24h` \| `7d` \| `30d`). |

### FiltersParams

| Field             | Type               | Required | Description                                 |
| ----------------- | ------------------ | -------- | ------------------------------------------- |
| `collection`      | `string \| number` | No       | Collection id to scope the tree.            |
| `tree`            | `number`           | No       | Explicit filter tree id.                    |
| `targetPage`      | `string`           | No       | `search` \| `collection`.                   |
| `targetId`        | `number`           | No       | Target object id.                           |
| `locale`          | `string`           | No       | BCP-47 locale.                              |
| `market`          | `number`           | No       | Shopify market id.                          |
| `includeValues`   | `boolean`          | No       | Include facet values (default `true`).      |
| `includeDisabled` | `boolean`          | No       | Include disabled filters (default `false`). |

### FilterAggregationsParams

| Field               | Type                                                        | Required | Description                                                       |
| ------------------- | ----------------------------------------------------------- | -------- | ----------------------------------------------------------------- |
| `collection`        | `string \| number`                                          | No       | Collection id to scope aggregation.                               |
| `tree`              | `number`                                                    | No       | Explicit filter tree id.                                          |
| `query`             | `string`                                                    | No       | Search term (may be `""`).                                        |
| `appliedFilters`    | `Array<{ key, value }>`                                     | No       | Applied filter selections.                                        |
| `facets`            | `Array<{ key }>`                                            | No       | Which facets to aggregate.                                        |
| `locale` / `market` | `string` / `number`                                         | No       | Locale / market.                                                  |
| `options`           | `{ includeZeroCounts?, includeDisabled?, sortBy?, limit? }` | No       | Aggregation options (`sortBy`: `count` \| `alpha` \| `position`). |
| `visitorId`         | `string`                                                    | No       | Visitor id.                                                       |

### SearchParams

| Field                                   | Type                                                                                        | Required | Description                                      |
| --------------------------------------- | ------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------ |
| `query`                                 | `string`                                                                                    | No       | Search term (may be `""`).                       |
| `targetPage`                            | `string`                                                                                    | No       | `search` \| `collection`.                        |
| `targetId`                              | `number`                                                                                    | No       | Target object id (e.g. collection id).           |
| `locale` / `market`                     | `string` / `number`                                                                         | No       | Locale / market.                                 |
| `facets`                                | `Array<{ key, operator?, value }>`                                                          | No       | Applied facets (`operator`: `or` \| `and` \| …). |
| `sort`                                  | [`SearchSort`](#searchsort-sort)                                                            | No       | Result ordering (default `relevance`).           |
| `view`                                  | [`SearchView`](#searchview-view)                                                            | No       | `product_details` (default) \| `product_ids`.    |
| `pagination`                            | `{ page?, limit? }`                                                                         | No       | Page-based pagination (limit ≤ 100).             |
| `options`                               | `{ includeAggregations?, includeHighlights?, includeFacets?, boostInStock?, personalize? }` | No       | Search options.                                  |
| `visitorId` / `clientId` / `customerId` | `string`                                                                                    | No       | Identity triple.                                 |

### ImageSearchParams

| Field                                   | Type                             | Required | Description                                                             |
| --------------------------------------- | -------------------------------- | -------- | ----------------------------------------------------------------------- |
| `image`                                 | `string`                         | Cond.    | Base64 or `data:` URL. Exactly one of `image` / `imageUrl`.             |
| `imageUrl`                              | `string`                         | Cond.    | http(s) URL or `data:` base64 URL. Exactly one of `image` / `imageUrl`. |
| `facets`                                | `Record<string, any> \| Array`   | No       | Applied filters.                                                        |
| `locale` / `market`                     | `string` / `number`              | No       | Locale (default `en`) / market.                                         |
| `view`                                  | [`SearchView`](#searchview-view) | No       | `product_details` (default) \| `product_ids`.                           |
| `pagination`                            | `{ page?, limit? }`              | No       | Page-based pagination.                                                  |
| `visitorId` / `clientId` / `customerId` | `string`                         | No       | Identity triple.                                                        |

### SearchTrack

| Field         | Type                                            | Required | Description                            |
| ------------- | ----------------------------------------------- | -------- | -------------------------------------- |
| `request_id`  | `string`                                        | No       | `request_id` from the search response. |
| `search_term` | `string`                                        | No       | The search term.                       |
| `search_type` | `string`                                        | No       | `text` \| `image`.                     |
| `products`    | `Array<{ product_id, variant_id?, quantity? }>` | No       | Products involved.                     |
| `filters`     | `Array<{ key, value }>`                         | No       | Applied filters.                       |
| `source`      | `string`                                        | No       | Interaction source.                    |
| `page_type`   | `string`                                        | No       | Page type.                             |

## Enums & value sets

Several fields accept a fixed set of values. `recommendationType` / `creationType` are typed as `string` in the SDK (for forward-compat), but only the values below are meaningful.

### RecommendationType (`recommendationType`)

| Value                   | Notes                                                           |
| ----------------------- | --------------------------------------------------------------- |
| `similar_products`      | Supported on every recommendation endpoint (v2, v3, automatic). |
| `bought_together`       | v3 `/recommendations` only.                                     |
| `recently_viewed`       |                                                                 |
| `cross_sell`            |                                                                 |
| `bestsellers`           |                                                                 |
| `trending`              |                                                                 |
| `personalized`          |                                                                 |
| `recent_launch`         |                                                                 |
| `collections`           |                                                                 |
| `purchases`             |                                                                 |
| `promoted`              |                                                                 |
| `custom`                |                                                                 |
| `email_recommendations` |                                                                 |

<Note>
  `fetchV3Recommendations` / `getRecommendations` accept any of the above, but the backend currently returns results only for `similar_products` and `bought_together`. `fetchV2Recommendations` and `fetchAutomaticRecommendations` support `similar_products` only.
</Note>

### CreationType (`creationType`)

| Value       |
| ----------- |
| `manual`    |
| `automatic` |

### RecommendationView (`view`)

| Value             | Result item shape                            |
| ----------------- | -------------------------------------------- |
| `product_details` | Full product objects (`RecommendedProduct`). |
| `product_ids`     | `{ product_id: number }`.                    |

### TopStrategy (`strategy`)

**Uppercase** — maps directly to the backend enum.

| Value          |
| -------------- |
| `BESTSELLERS`  |
| `NEW_ARRIVALS` |

### BestsellerMetric (`strategyOptions.bestsellerMetric`)

| Value      |
| ---------- |
| `revenue`  |
| `quantity` |
| `orders`   |

`strategyOptions.salesTimePeriod` accepts `7`, `15`, or `30` (days).

### TopFacet (`facets[]`)

| Value          |
| -------------- |
| `vendor`       |
| `product_type` |
| `tag`          |
| `price`        |

### HeadlessEventChannel (`channel`)

| Value      | Notes                 |
| ---------- | --------------------- |
| `hydrogen` | Default for this SDK. |
| `headless` |                       |
| `mobile`   |                       |

### Event type (`event.type`)

| Value      |
| ---------- |
| `standard` |
| `custom`   |

### PageType (`pageType`)

`product_page`, `collection`, `home`, `cart`, `order_confirm`, `other`, `blog`, `ajax_cart`, `404`, `checkout`, `returns`

### ConsentType (`pixel.consent[]`)

`analytics`, `marketing`, `preferences`, `sale_of_data`

### Event names (`event.name`)

Standard Shopify analytics events the SDK forwards: `page_viewed`, `product_viewed`, `collection_viewed`, `cart_viewed`, `search_submitted`, `product_added_to_cart`, `product_removed_from_cart`. Custom attribution events: `glood:section:render`, `glood:section:view`, `glood:section:click`, `glood:section:add_to_cart`, and for search: `glood:instant_search_triggered`, `glood:search_result_rendered`, `glood:search_result_clicked`, `glood:search:add_to_cart`, `glood:search_filter_updated`.

### SearchView (`view`)

Product render mode for search endpoints:

| Value             | Result shape                                                                                                    |
| ----------------- | --------------------------------------------------------------------------------------------------------------- |
| `product_details` | Full [`SearchProduct`](/for-developers/glood-hydrogen-sdk/api-reference/types#searchproduct) objects (default). |
| `product_ids`     | `{ product_id: number }` only.                                                                                  |

### SearchSort (`sort`)

`relevance` (default), `title_asc`, `title_desc`, `price_asc`, `price_desc`, `best_selling`, `oldest`, `newest`.

### InstantSearchObject (`objects[]`)

`product`, `collection`, `page`, `article`, `query_suggestion`, `autocorrect`.

### Search event channel (`channel`)

The search events API (`sendSearchEvent`) uses **uppercase** channels: `HYDROGEN`, `HEADLESS`, `MOBILE`. `sendSearchEvent` defaults to `HYDROGEN`.

## See Also

<CardGroup cols={2}>
  <Card title="Types" href="/for-developers/glood-hydrogen-sdk/api-reference/types">
    Full request/response type definitions.
  </Card>

  <Card title="Recommendations API" href="/for-developers/glood-hydrogen-sdk/api-reference/recommendations-api">
    Standalone function usage and endpoints.
  </Card>
</CardGroup>
