# window.aeoSettings Configuration Reference

> Canonical source: [window.aeoSettings Configuration Reference](https://ai.answer.cloud/pages/window-aeosettings-configuration-reference/)

The file provides documentation for the answer.cloud embed.js file. It provides functionality like the chat experience, site search, and analytics.

window.aeoSettings is a global configuration object read by the AEO embed loader.
It determines which features load, how they behave, and how analytics are recorded.

Only the features explicitly enabled will be dynamically imported and initialized.

---

## Minimal Example
```js
<script>
  window.aeoSettings = {
    organization_id: 123,
    organization_sub: "ai",
    organization_domain: "example.com",

    chat: {
      enabled: true
    },

    site_search: {
      enabled: true
    },

    analytics: {
      enabled: true
    }
  };
</script>
```

<script type="module" src="https://app.answer.cloud/embed/loader.mjs"></script>

---

## Top-Level Settings

### organization_id (required)

Type: `number`

The internal AEO organization ID.

Used for:
- analytics attribution
- chat widget routing
- site search queries

---

### organization_sub (required for some features)

Type: `string`

The subdomain used for AI-accessible content and chat links.

Example:

`organization_sub: "ai"`

Used to construct URLs like:

https://ai.example.com/page.txt

---

### organization_domain (required for some features)

Type: `string`

The primary domain for the organization.

Example:

organization_domain: "example.com"

---

### base_url (optional)

Type: `string`

Overrides the default AEO backend URL.

Default:

`https://app.answer.cloud`

Used for:
- analytics
- chat widget iframe
- site search API

---

### css_path (optional)

Type: `string`

URL to a custom CSS file applied inside the chat widget iframe.

Example:

`css_path: "https://example.com/aeo-chat.css"`

---

## Analytics

### analytics

Controls client-side analytics collection.

Structure:
```js
analytics: {
  enabled: boolean
}
```

Fields:

- enabled (boolean, default: true)
  When set to false, all analytics are disabled.

Analytics are only disabled when explicitly set to false.

Example:
```js
analytics: {
  enabled: false
}
```

---

## Chat Widget (Floating AI Chat)

### chat

Enables and configures the floating AI chat widget.

Structure:
```js
chat: {
  enabled: boolean,
  button_text: string,
  button_color: string,
  button_text_color: string,
  intro_text: string
}
```

Fields:

- enabled (boolean, default: false)
  Loads the chat widget when true.

- button_text (string, default: "Ask AI")
  Placeholder text in the chat trigger.

- button_color (string, default: "#111")
  Accent color for the widget.

- button_text_color (string, default: "#fff")
  Text color used in the trigger UI.

- intro_text (string, default: "Hi, how can I help you today?")
  Initial assistant message shown in the chat.

Example:
```js
chat: {
  enabled: true,
  button_text: "Ask Acme AI",
  button_color: "#0047ff",
  button_text_color: "#ffffff",
  intro_text: "Hello! How can I help you with Acme today?"
}
```

---

## “Chat with this page in ChatGPT” Buttons

### button

Injects “Chat with this page in ChatGPT” links into the page.

Structure:
```js
button: {
  enabled: boolean,
  subdomain: string,
  button_selector: string
}
```

Fields:

- enabled (boolean, default: false)
  Enables button injection.

- subdomain (string, default: "ai")
  Subdomain used to build .txt page URLs.

- button_selector (string, default: ".ai-btns")
  CSS selector for containers where links should be injected.

Example:
```js
button: {
  enabled: true,
  subdomain: "ai",
  button_selector: ".ai-buttons"
}
```

This generates links referencing:

https://ai.example.com/current-page.txt

---

## Site Search (Keyword + AI Semantic Search)

### site_search

Enables on-site AI search and summarization.

Structure:
```js
site_search: {
  enabled: boolean,
  button_text: string,
  form_selector: string,
  input_selector: string,
  results_selector: string
}
```

Fields:

- enabled (boolean, default: false)
  Loads the site search module.

- button_text (string, default: "Chat with AI")
  CTA text used in the UI.

- form_selector (string)
  Selector for the search form container.

- input_selector (string)
  Selector for the query input element.

- results_selector (string)
  Selector for the container where results are rendered.

Example:
```js
site_search: {
  enabled: true,
  button_text: "Chat with Acme AI",
  form_selector: "#site-search",
  input_selector: "#site-search input",
  results_selector: "#search-results"
}
```

---

## Feature Flags Summary

Feature                     Enabled when
---------------------------------------------------
Analytics                   analytics.enabled !== false
Chat widget                 chat.enabled === true
ChatGPT page buttons        button.enabled === true
Site search                 site_search.enabled === true

Only enabled features are dynamically imported.

---

## Full Example
```js
window.aeoSettings = {
  organization_id: 42,
  organization_sub: "ai",
  organization_domain: "example.com",

  css_path: "https://example.com/aeo-chat.css",

  analytics: {
    enabled: true
  },

  chat: {
    enabled: true,
    button_text: "Ask Example AI",
    intro_text: "How can I help you today?"
  },

  button: {
    enabled: true,
    subdomain: "ai",
    button_selector: ".ai-btns"
  },

  site_search: {
    enabled: true,
    button_text: "Chat with Example AI",
    form_selector: "#search",
    input_selector: "#search input",
    results_selector: "#results"
  }
};
```

---

## Notes

- All fields are optional except organization_id
- Feature configs are ignored unless their enabled flag is true
- Safe to include unused sections
- Designed for dynamic imports, caching, and future extensibility
