---
updatedAt: 2026-09-29T23:38:36.000Z
agentTools:
  projectIndex: https://dev.kevel.com/llms.txt
---

# VAST Ad Code

> 🚧 Caution
>
> To serve VAST ads, please contact your account manager.

## Overview

A VAST ad tag takes the form of a URL that your video player calls. At this time, you must generate that URL yourself.

## Generating the Request Object

To construct the URL, you first build a JSON **request** object containing one or more **placements**.

**Request:**

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

      <th>
        Required?
      </th>

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

  <tbody>
    <tr>
      <td>
        `p`
      </td>

      <td>
        yes
      </td>

      <td>
        Array of one or more Placement objects (see below)
      </td>
    </tr>

    <tr>
      <td>
        `ukey`
      </td>

      <td>
        no
      </td>

      <td>
        A UserDB user key
      </td>
    </tr>

    <tr>
      <td>
        `ip`
      </td>

      <td>
        no
      </td>

      <td>
        An IP address (overrides the remote IP of the request)
      </td>
    </tr>

    <tr>
      <td>
        `ref`
      </td>

      <td>
        no
      </td>

      <td>
        A referrer URL (overrides the Referer header of the request)
      </td>
    </tr>

    <tr>
      <td>
        `url`
      </td>

      <td>
        no
      </td>

      <td>
        The URL to use as the current page URL when selecting an ad
      </td>
    </tr>

    <tr>
      <td>
        `t`
      </td>

      <td>
        no
      </td>

      <td>
        The UNIX epoch timestamp to use when selecting an ad
      </td>
    </tr>

    <tr>
      <td>
        `kw`
      </td>

      <td>
        no
      </td>

      <td>
        Keywords for the request
      </td>
    </tr>

    <tr>
      <td>
        `nt`
      </td>

      <td>
        no
      </td>

      <td>
        Do Not Track. If set to 1, DNT is enabled
      </td>
    </tr>

    <tr>
      <td>
        `b`
      </td>

      <td>
        no
      </td>

      <td>
        A list of blocked items
      </td>
    </tr>

    <tr>
      <td>
        `bf`
      </td>

      <td>
        no
      </td>

      <td>
        Bot Filtering. If set to 1, bot filtering is enabled
      </td>
    </tr>
  </tbody>
</Table>

**Placement:**

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

      <th>
        Required?
      </th>

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

  <tbody>
    <tr>
      <td>
        `t`
      </td>

      <td>
        yes
      </td>

      <td>
        An adType ID, or an array of adType IDs
      </td>
    </tr>

    <tr>
      <td>
        `n`
      </td>

      <td>
        yes
      </td>

      <td>
        The numeric network ID to use when selecting an ad
      </td>
    </tr>

    <tr>
      <td>
        `s`
      </td>

      <td>
        yes
      </td>

      <td>
        The numeric site ID to use when selecting an ad
      </td>
    </tr>

    <tr>
      <td>
        `z`
      </td>

      <td>
        no
      </td>

      <td>
        Zero or more zone IDs to use when selecting an ad
      </td>
    </tr>

    <tr>
      <td>
        `c`
      </td>

      <td>
        no
      </td>

      <td>
        A numeric campaign ID; if specified, only consider ads in that campaign
      </td>
    </tr>

    <tr>
      <td>
        `f`
      </td>

      <td>
        no
      </td>

      <td>
        A numeric flight ID; if specified, only consider ads in that flight
      </td>
    </tr>

    <tr>
      <td>
        `a`
      </td>

      <td>
        no
      </td>

      <td>
        A numeric ad (flight-creative map) ID; if specified, only serve that ad if possible
      </td>
    </tr>

    <tr>
      <td>
        `u`
      </td>

      <td>
        no
      </td>

      <td>
        A URL that should be used as the click-through target for the ad
      </td>
    </tr>

    <tr>
      <td>
        `p`
      </td>

      <td>
        no
      </td>

      <td>
        A hash of key/value pairs used for [Custom Targeting](https://dev.kevel.com/docs/custom-targeting)
      </td>
    </tr>

    <tr>
      <td>
        `ck`
      </td>

      <td>
        no
      </td>

      <td>
        A hash of key/value pairs used with [ContentDB](https://dev.kevel.com/docs/contentdb-1)
      </td>
    </tr>
  </tbody>
</Table>

Here is a constructed request object with one placement:

```json
{"p":[{"n":1234,"t":1234,"s":123456}]}
```

## Generating the VAST URL

Once you have a request object, URL-encode it and pass it to the VAST endpoint `https://e-<networkId>.adzerk.net/vast3` using the `?r=` querystring.

For example, this request object:

```json
{"p":[{"n":1234,"t":1234,"s":123456}]}
```

URL-encodes to:

```
%7B%22p%22%3A%5B%7B%22n%22%3A1234%2C%22t%22%3A1234%2C%22s%22%3A123456%7D%5D%7D%0A
```

which makes the ad code URL:

```
https://e-1234.adzerk.net/vast3?r=%7B%22p%22%3A%5B%7B%22n%22%3A1234%2C%22t%22%3A1234%2C%22s%22%3A123456%7D%5D%7D%0A
```