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

# Custom Attributes

> Learn how to define and use custom attributes to personalize user experiences on your website.

<Info>
  **Prerequisite**

  MoEngage Personalize SDK must be integrated on your webpage to define custom attributes.
</Info>

# What are custom attributes?

Custom attributes are used to define what pages on a website and what values on those pages can be used to personalize the experience for visitors. It helps you avoid configuring a combination of multiple URLs to deliver the experience on the right set of pages.

Below are the set of standard fields that can be used as a targeting criterion:

* `pageType`
* `category`
  * `firstLevel`
  * `secondLevel`
  * `thirdLevel`
  * `fourthLevel`
* `unitPrice`
* `salePrice`
* `currency`

Any values apart from the above can be defined in the **custom** block and then used for targeting.

<CodeGroup>
  ```javascript JavaScript wrap theme={null}
  window.moePageContext = {
    pageType: "product page",
    category: {
      firstLevel: "Clothing & Accessories",
      secondLevel: "T-shirts",
      thirdLevel: "Polos"
    },
    unitPrice: "24",
    salePrice: "18",
    discount: "25",
    currency: "USD",
    custom: {
      size: "Medium",
      color: "Black",
      gender: "Unisex"    
    }    
  };
  ```
</CodeGroup>

**Below are some examples of using custom attributes**

## E-commerce

| Field name    | Description                                                                                                                                                                                                                                                                                                                     | Example                                                                                                                                                    |
| :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **pageType**  | Define the type of page. Standard page type values are: *Homepage, category, cart, checkout, success*                                                                                                                                                                                                                           | `pageType: "Homepage"` <br /> **OR** <br /> `pageType: "category"`                                                                                         |
| **category**  | Experiences can be targeted for any of the 4 levels of categories.                                                                                                                                                                                                                                                              | `category: { firstLevel: "Electronics", secondLevel: "Home Audio", thirdLevel: "Speaker", fourthLevel: "Bluetooth Speakers" }`                             |
| **unitPrice** | Target product pages based on the original price of the product.                                                                                                                                                                                                                                                                | `unitPrice: "24"`                                                                                                                                          |
| **salePrice** | Target product pages based on the discounted price of the product.                                                                                                                                                                                                                                                              | `salePrice: "18"`                                                                                                                                          |
| **discount**  | Target product pages based on the discount amount on the product.                                                                                                                                                                                                                                                               | `discount: "25"`                                                                                                                                           |
| **currency**  | Target product pages based on the currency of the product.                                                                                                                                                                                                                                                                      | `currency: "USD"`                                                                                                                                          |
| **custom**    | Any other trait that you want to target for personalization. <br /><br /> **Example:** Personalize all pages that display **White, Medium**-size Polo T-shirts for **Men** <br /> **OR** <br /> Personalize checkout page only when the cart value is \$500 or above and cart discount is 0 and cart contains at least 2 items. | **custom**: `{ color: "White", size: "M", gender: "Male" }` <br /> **OR** <br /> **custom**: `{ cartAmount: "750", cartDiscount: "0", cartQuantity: "4" }` |

## Finance

| Attribute    | Description                                                                                                             | Example                                                                                                        |
| :----------- | :---------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- |
| **pageType** | Define the type of page. Standard page type values are: *Homepage, blog, service/products, resources/downloads, offers* | `pageType: "Homepage"` <br /> **OR** <br /> `pageType: "products"` <br /> **OR** <br /> `pageType: "services"` |
| **category** | Experiences can be targeted for any of the 4 levels of categories.                                                      | `category: { firstLevel: "Insurance", secondLevel: "Health Insurance", thirdLevel: "Medical Insurance" }`      |

For further assistance, please contact your MoEngage Customer Success Manager (CSM) or the Support team.
