> ## 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.

# Custom Web Pixel Events

> Learn about the custom Web Pixel events supported by Glood.AI

## Overview

Glood.AI's Web Pixel extension includes custom events to provide enhanced personalization and analytics capabilities. This guide covers all the custom Web Pixel events that our platform supports.

### What are Glood.AI Custom Web Pixel Events?

Glood.AI Custom Web Pixel events are specialized user interactions and activities that occur on your Shopify store. These events help track customer behavior specific to Glood.AI's personalization features, enabling:

* Advanced customer preference tracking
* Enhanced personalization capabilities
* Detailed analytics and insights
* Optimized recommendation performance

## Supported Events

The following section details all the custom events supported by Glood.AI's Web Pixel extension.

<AccordionGroup>
  <Accordion icon="sliders" title="Customer Preferences">
    Events for tracking and storing customer preferences for personalization.

    ### Event: `glood:customer_preference`

    This event is triggered to store customer preferences for personalization purposes within the **Glood.AI** platform.

    ### Event Structure

    #### Event Name

    ```js theme={null}
    glood:customer_preference
    ```

    #### Payload

    The payload contains a structured object with the following fields:

    | Field         | Type             | Description                                                   |
    | ------------- | ---------------- | ------------------------------------------------------------- |
    | `preferences` | Array of Objects | An array of key-value pairs representing customer preferences |

    #### Preferences Object

    Each object in the `preferences` array contains:

    | Field   | Type   | Description                                                                 |
    | ------- | ------ | --------------------------------------------------------------------------- |
    | `key`   | String | The key representing the type of preference (e.g., "tags", "categories")    |
    | `value` | String | A string representing the value associated with the key (e.g., "tag1,tag2") |

    ### Example Usage

    ```javascript theme={null}
    Shopify.analytics.publish('glood:customer_preference', {
        preferences: [
            { key: 'tags', value: "tag1,tag2" }
        ]
    });
    ```

    ### Purpose

    The primary purpose of this event is to store customer preferences in **Glood.AI** for:

    * **Personalization**: Enhance customer experiences with tailored content and recommendations
    * **Behavior Analysis**: Understand customer behavior through preference analysis
    * **Targeted Campaigns**: Create specific campaigns based on customer preferences

    ### Use Cases

    * Storing customer-selected tags, categories, or other preferences
    * Personalizing product recommendations or content on a Shopify store
    * Supporting segmentation and analytics within **Glood.AI**
  </Accordion>

  <Accordion icon="chart-mixed" title="Section Interaction Events">
    Events for tracking user interactions with Glood recommendation sections.

    ### Event: `glood:section:click`

    This event is triggered when a user clicks on a product within a Glood recommendation section.

    ### Event Structure

    #### Event Name

    ```js theme={null}
    glood:section:click
    ```

    #### Payload

    The payload contains information about the clicked product and section:

    | Field                  | Type           | Description                                               |
    | ---------------------- | -------------- | --------------------------------------------------------- |
    | `page`                 | String         | The page ID where the click occurred                      |
    | `parent.productId`     | String \| null | ID of the current product page (if applicable)            |
    | `parent.variantId`     | String \| null | ID of the current product variant (if applicable)         |
    | `products[].productId` | String         | ID of the clicked product                                 |
    | `products[].variantId` | String         | ID of the clicked product variant                         |
    | `section`              | String         | ID of the Glood recommendation section                    |
    | `sectionServeId`       | String         | Unique serve ID for the section render                    |
    | `requestId`            | String         | Unique request ID from the Glood recommendations API call |

    ### Example Usage

    ```javascript theme={null}
    Shopify.analytics.publish('glood:section:click', {
      page: "55380",
      parent: {
        productId: null,
        variantId: null
      },
      products: [{
        productId: "4594143232103",
        variantId: "32389151621223"
      }],
      section: "216700",
      sectionServeId: "98ae55db-8e25-46be-956e-2024d820edb4",
      requestId: "1734410855-8dd0e6a0-4365-489b-b622-2fedca7129c0"
    });
    ```

    ### Event: `glood:section:add_to_cart`

    This event is triggered when a product is added to cart from a Glood recommendation section.

    ### Event Structure

    #### Event Name

    ```js theme={null}
    glood:section:add_to_cart
    ```

    #### Payload

    The payload contains information about the added product and section:

    | Field                  | Type           | Description                                               |
    | ---------------------- | -------------- | --------------------------------------------------------- |
    | `page`                 | String         | The page ID where the add to cart occurred                |
    | `parent.productId`     | String \| null | ID of the current product page (if applicable)            |
    | `parent.variantId`     | String \| null | ID of the current product variant (if applicable)         |
    | `products[].productId` | String         | ID of the product added to cart                           |
    | `products[].variantId` | String         | ID of the product variant added to cart                   |
    | `products[].quantity`  | Number         | Quantity of the product added to cart                     |
    | `section`              | String         | ID of the Glood recommendation section                    |
    | `sectionServeId`       | String         | Unique serve ID for the section render                    |
    | `requestId`            | String         | Unique request ID from the Glood recommendations API call |

    ### Example Usage

    ```javascript theme={null}
    Shopify.analytics.publish('glood:section:add_to_cart', {
      page: "55380",
      parent: {
        productId: null,
        variantId: null
      },
      products: [{
        productId: "4594143232103",
        variantId: "32389151621223",
        quantity: 1
      }],
      section: "216700",
      sectionServeId: "98ae55db-8e25-46be-956e-2024d820edb4",
      requestId: "1734410855-8dd0e6a0-4365-489b-b622-2fedca7129c0"
    });
    ```

    ### Purpose

    These events help track user interactions with Glood recommendation sections to:

    * **Measure Engagement**: Track clicks and conversions from recommendation sections
    * **Analyze Performance**: Evaluate the effectiveness of different recommendation strategies
    * **Improve Recommendations**: Use interaction data to enhance recommendation algorithms

    ### Use Cases

    * Tracking which recommended products users click on
    * Measuring conversion rates from recommendation sections
    * Analyzing user behavior patterns with recommended products
  </Accordion>
</AccordionGroup>
