# SDK Events

The SDK emits events for all important events. These events can be listened for in order to execute custom logic like tracking, visual changes, or any other action that should occur after an event.

| Event                      | Emit Trigger                                                               |
| -------------------------- | -------------------------------------------------------------------------- |
| on\_loaded                 | The SDK has been successfully loaded in to the visitor's browser           |
| on\_load\_error            | There was an unexpected error while attempting to load the SDK             |
| on\_web\_push\_supported   | The visitor's web browser supports web push                                |
| on\_web\_push\_unsupported | The visitor's web browser does not support web push                        |
| on\_ready                  | The SDK has gather all required configuration and is ready for interaction |
| on\_prompt\_eligible       | The visitor is eligible to be shown the prompt                             |
| on\_prompt\_ineligible     | The visitor should not be shown the prompt                                 |
| on\_prompt\_shown          | After a prompt is successfully shown to the visitor                        |
| on\_prompt\_dismissed      | After a visitor dismisses the prompt                                       |
| on\_prompt\_allowed        | After a visitor allows the prompt                                          |
| on\_permission\_shown      | After the visitor is shown the browser's native permission dialog          |
| on\_permission\_allowed    | After the visitor allows the browser's native permission dialog            |
| on\_permission\_denied     | After the visitor declines the browser's native permission dialog          |
| on\_permission\_dismissed  | After the visitor dismisses the browser's native permission dialog         |

## Example: on\_ready

For example, to run your own custom code once the SDK is ready for interaction:

```javascript
pushly('on_ready', function() {
  console.log('example');
});
```


---

# Agent Instructions: 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://documentation.pushly.com/integration/web-push/sdk/events.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.
