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

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