> For the complete documentation index, see [llms.txt](https://docs.frontnow.com/advise/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frontnow.com/advise/integration/events.md).

# Events

{% hint style="info" %}
Before using these events, ensure that Frontnow Advise has been properly initialized. For setup instructions, please refer to the [Getting Started](/advise/introduction/getting-started.md) page.
{% endhint %}

{% hint style="success" %}

#### Google Analytics Integration

If your site already integrates with Google Analytics, all of Advise events will be automatically forwarded with the prefix "***frontnow:\[eventname]"***

Examples: ***frontnow:open*** or ***frontnow:message***
{% endhint %}

### `ready`

This event gets triggered when Frontnow Advise is initialized.

```javascript
advisor.on('ready', () => {
    console.log('Advisor is ready!');
});
```

### `open`

This event gets triggered when Frontnow Advise is opened.

```javascript
advisor.on('open', () => {
    console.log('Advisor is open!');
});
```

### `close`

This event gets triggered when Frontnow Advise is closed.

```javascript
advisor.on('close', () => {
    console.log('Advisor is closed!');
});
```

### `message`

This event gets triggered when a message is received.

```javascript
advisor.on('message', (data) => {
    console.log('Received message:', data);
});
```

```jsdoc
/**
 * @typedef {Object} MessageEventData
 * @property {string} value - The content of the message.
 */
```

### `recommended-question`

This event gets triggered when a recommended question is clicked.

```javascript
advisor.on('recommended-question', (data) => {
    console.log('Recommended question:', data);
});
```

```jsdoc
/**
 * @typedef {Object} RecommendedQuestionEventData
 * @property {string} value - The prompt text of the recommended question.
 */
```

### `discovery-topic`

This event gets triggered when a discovery topic is clicked.

```javascript
advisor.on('discovery-topic', (data) => {
    console.log('Discovery topic:', data);
});
```

```jsdoc
/**
 * @typedef {Object} DiscoveryTopicEventData
 * @property {string} topic - The identifier of the discovery topic.
 * @property {string} title - The title of the discovery topic.
 * @property {string} value - The prompt text for the discovery topic.
 */
```

### `document-click`

This event gets triggered when a document is clicked.

```javascript
advisor.on('document-click', (data) => {
    console.log('Document clicked:', data);
});
```

```jsdoc
/**
 * @typedef {Object} DocumentClickEventData
 * @property {string} title - The title of the clicked document.
 * @property {string} url - The URL of the clicked document.
 */
```

### `follow-up-click`

This event gets triggered when a follow-up question is clicked.

```javascript
advisor.on('follow-up-click', (data) => {
    console.log('Follow-up question clicked:', data);
});
```

```jsdoc
/**
 * @typedef {Object} FollowUpClickEventData
 * @property {string} question - The follow-up question.
 * @property {string} headline - The headline associated with the follow-up question.
 * @property {string} prompt - The prompt text for the follow-up question.
 */
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.frontnow.com/advise/integration/events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
