---
updatedAt: 2026-08-01T13:28:07.000Z
agentTools:
  projectIndex: https://dev.kevel.com/llms.txt
---

# Registering Callbacks From the JavaScript Ad Code

## Overview

`ados.js` is the client-side JavaScript library that Kevel's ad code uses to request and display ads in the browser. As ads are served, it fires messages for a range of events.

You can add the `ados.on()` function to your JavaScript ad code to listen for those events and register callbacks.

## Available Events

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Event
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `ImpressionCounted`
      </td>

      <td>
        Fired when an impression pixel is loaded to the page
      </td>
    </tr>

    <tr>
      <td>
        `load`
      </td>

      <td>
        Fired when `ados.js` is loaded
      </td>
    </tr>

    <tr>
      <td>
        `log`
      </td>

      <td>
        Fired whenever `ados.js` logs something to the JS console
      </td>
    </tr>

    <tr>
      <td>
        `passbackExec`
      </td>

      <td>
        Fired whenever a passback chain renders an ad (note that the ad may include a passback from a 3rd party server, so this may not indicate the final served ad)
      </td>
    </tr>

    <tr>
      <td>
        `passbackLoad`
      </td>

      <td>
        Fired when a passback chain starts loading
      </td>
    </tr>

    <tr>
      <td>
        `passbackNext`
      </td>

      <td>
        Fired at each step of the passback chain
      </td>
    </tr>

    <tr>
      <td>
        `passbackTimeout`
      </td>

      <td>
        Fired when a passback times out
      </td>
    </tr>

    <tr>
      <td>
        `refresh`
      </td>

      <td>
        Fired whenever the ad code refreshes, meaning whenever `ados_refresh` is called
      </td>
    </tr>

    <tr>
      <td>
        `requestStart`
      </td>

      <td>
        Fired when an ad request is made
      </td>
    </tr>
  </tbody>
</Table>

## Registering Callbacks

The format for using `ados.on()` is:

`ados.on(message, callback);`

For example:

```javascript
ados.on("ImpressionCounted", function(msg) {
  console.log("user key for " + msg.data.div + " is: " + msg.data.shim.uk);
});
```

This listens for the `ImpressionCounted` message. The message data carries the impression shim, which holds the name of the div and the userkey in its `uk` field. Each time the event fires, the callback logs the div name and userkey to the JS console, for every impression loaded on the page:

`user key for azk123456 is: ue-29thd03`

If you have any questions about `ados.js` callbacks, please contact Kevel support.