> For the complete documentation index, see [llms.txt](https://docs.adena.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adena.app/integrations/detect-events/detect-an-account-change.md).

# Detect an Account Change

When a user switches their account to another one, the information that the web application has initially retrieved may not match the current account. To display the correct information and request transaction approvals to the matching account, the web application must track account changes happening on Adena with the function below.

#### Code

```javascript
adena.On("changedAccount", (address: string) => void);
```

#### **Params**

<table><thead><tr><th width="173">Key</th><th width="286.3333333333333">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>key</code></td><td>'<code>changedAccount'</code></td><td>The event key of the '<code>changedAccount'</code></td></tr><tr><td><code>function</code></td><td><code>(address: string) => void</code></td><td>The function that gets triggered by the event</td></tr></tbody></table>

#### Sample Request

```javascript
//this will emit an account change when the user switches the current account on Adena
adena.On("changedAccount", (address) => {
  console.log("changed address is " + address);
});
```


---

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

```
GET https://docs.adena.app/integrations/detect-events/detect-an-account-change.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
