> For the complete documentation index, see [llms.txt](https://docs.exads.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.exads.com/publishers/sites-and-zones/subids.md).

# Using Sub IDs

As a Publisher, once you have added your sites and ad zones, you can use Sub IDs to segment your traffic, for example by traffic source.&#x20;

This information then appears in the [**Statistics**](/publishers/publisher-statistics.md) tab, in the **Sub IDs** sub-tab.

## Putting Sub IDs into Your Ad Zone Code <a href="#putting-sub-ids-into-your-a-d-zone-code" id="putting-sub-ids-into-your-a-d-zone-code"></a>

After you click **Create** in the **New Zone** screen, the Admin Panel shows the code for your new ad zone.

To use Sub IDs, add the `sub` or `ad_sub` parameter to the ad zone code and specify the number of the Sub ID you want to use.

{% hint style="info" %}
**Note**: A Sub ID should be a number between 1 and [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32.maxvalue?view=net-5.0). Do not use zeroes at the beginning of Sub IDs.
{% endhint %}

### Method 1: sub <a href="#method-1-sub" id="method-1-sub"></a>

For iframes or simple links (email zone, direct link) simply add this code to the iframe tags (where XXXXXX is any six-digit integer):

```
&sub=XXXXXX
```

### Method 2: ad\_sub <a href="#method-2-ad_sub" id="method-2-ad_sub"></a>

If you use JavaScript tags, add this JavaScript variable (where XXXXXX is any six-digit integer):

```javascript
 ad_sub = "XXXXXX"; 
```

### Method 3: data-sub <a href="#method-3-data-sub" id="method-3-data-sub"></a>

When using the Asynchronous Script, simply add this property to the ins element (where XXXXXX is any six-digit integer):

```html
 data-sub = "XXXXXX" 
```

### Use in Different Ad Zone Formats <a href="#use-in-different-a-d-zone-formats" id="use-in-different-a-d-zone-formats"></a>

| Parameter | Used in                                                                                                                                                                         |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sub       | Desktop and Mobile Popunder (inline & remote script), In-Video Banner (JavaScript & VAST), In-Stream Video, Video Slider, Email Clicks, Direct Link, In-Page Push Notification. |
| ad\_sub   | Desktop and Mobile Popunder (Remote script), Mobile Interstitial Banner.                                                                                                        |
| data-sub  | Native Ads, Banner, Sticky Banner, Outstream Video, Instant Message, Mobile Instant Message, Desktop & Mobile Fullpage Interstitial.                                            |

## Examples <a href="#examples" id="examples"></a>

## Web <a href="#web" id="web"></a>

## Banner <a href="#banner" id="banner"></a>

### Asynchronous Script <a href="#asynchronous-script" id="asynchronous-script"></a>

Added `data-sub` = 123456789

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://a.examplesite.com/ads.js"></script>
<ins class="adsbynetwork" data-zoneid="3553853" data-sub="123456789"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}

### iFrame <a href="#iframe" id="iframe"></a>

Added `&sub`=123456

{% code overflow="wrap" expandable="true" %}

```html
<iframe src="//a.examplesite.com/iframe.php?idzone=1234567&size=300x250&sub=123456" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
```

{% endcode %}

## Popunder <a href="#popunder" id="popunder"></a>

### Inline & Remote Script <a href="#inline--remote-script" id="inline--remote-script"></a>

Added `sub`: 123456

{% code overflow="wrap" expandable="true" %}

```html
<script type="application/javascript">
(function() {

    //version 1.0.0

    var adConfig = {
    "ads_host": "a.examplesite.com",
    "syndication_host": "syndication.examplesite.com",
    "idzone": 1234567,
    "popup_fallback": false,
    "popup_force": false,
    "chrome_enabled": true,
    "new_tab": false,
    "frequency_period": 720,
    "frequency_count": 1,
    "trigger_method": 3,
    "trigger_class": "",
    "only_inline": false,
    "sub": "123456" 
};
```

{% endcode %}

### Remote Script Only <a href="#remote-script-only" id="remote-script-only"></a>

Added `ad_sub` = 123456

{% code overflow="wrap" expandable="true" %}

```html
<script type="application/javascript">
    var ad_idzone = "1234567",
    ad_popup_fallback = false,
    ad_popup_force = false,
    ad_chrome_enabled = true,
    ad_new_tab = false,
    ad_frequency_period = 720,
    ad_frequency_count = 1,
    ad_trigger_method = 3,
    ad_sub = "123456";
</script>
<script type="application/javascript" src="https://a.examplesite.com/popunder1000.js"></script>
```

{% endcode %}

## Instant Message <a href="#instant-message" id="instant-message"></a>

Added `data-sub` = 123456

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://ads.examplesite.com/ad-provider.js"></script>
<ins class="adsbynetwork" data-zoneid="1234567" data-sub="123456"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}

## Sticky Banner <a href="#sticky-banner" id="sticky-banner"></a>

Added `data-sub` = 123456

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://ads.examplesite.com/ad-provider.js"></script>
<ins class="adsbynetwork" data-zoneid="1234567" data-sub="123456"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}

## Desktop Fullpage Interstitial <a href="#desktop-fullpage-interstitial" id="desktop-fullpage-interstitial"></a>

Added `data-sub` = 123456

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://ads.examplesite.com/ad-provider.js"></script>
<ins class="adsbynetwork" data-zoneid="1234567" data-sub="123456"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}

## Email Banner <a href="#email-banner" id="email-banner"></a>

**Simple Image Tag**

Added `sub` = 123456

{% code overflow="wrap" expandable="true" %}

```html
<a href="https://s.examplesite.com/click.php?idzone=123&idnewsletter=newsletter20250321&iduniq=456" target="_blank">
  <img src="https://s.examplesite.com/ads-iframe-display.php?idzone=123&sub=123456&idnewsletter=newsletter20250321&iduniq=456" width="300" height="250">
</a>
```

{% endcode %}

## Video <a href="#video" id="video"></a>

## In-Video Banner (VAST) <a href="#in-video-banner-vast" id="in-video-banner-vast"></a>

Added `&sub`=123456

```
https://syndication.examplesite.com/v1/vast.php?idzone=1234567&sub=123456
```

## In-Video Banner (JavaScript) <a href="#in-video-banner-javascript" id="in-video-banner-javascript"></a>

Added `sub`: 123456

{% code overflow="wrap" expandable="true" %}

```html
<script type="application/javascript">
  var msgOpts = {
      // postroll: {},
      // pause: { padding: 1 },
      // offsetY: +40,
      idzone_300x250 : 1234567,
      preroll: {},
      show_thumb: 1,
      sub: 123456
  };
</script>
<script type="application/javascript" src="https://a.examplesite.com/invideo.js"></script>
```

{% endcode %}

## In-Stream Video (VAST) <a href="#in-stream-video-vast" id="in-stream-video-vast"></a>

Added `&sub`=123456

```
https://syndication.examplesite.com/v1/vast.php?idzone=1234567&sub=123456
```

## Video Slider <a href="#video-slider" id="video-slider"></a>

### Asynchronous Script <a href="#asynchronous-script-1" id="asynchronous-script-1"></a>

Added `data-sub`: 123456

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://ads.examplesite.com/ad-provider.js"></script>
<ins class="adsbynetwork" data-zoneid="1234567" data-sub="123456"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}

## Outstream Video <a href="#outstream-video" id="outstream-video"></a>

### Asynchronous Script <a href="#asynchronous-script-2" id="asynchronous-script-2"></a>

Added `data-sub` = 123456

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://a.examplesite.com/video-outstream.js"></script>
<ins class="adsbynetwork" data-zoneid="1234567" data-sub="123456"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}

### iFrame <a href="#iframe-1" id="iframe-1"></a>

Added `data-sub`=123456

{% code overflow="wrap" expandable="true" %}

```html
<script type="application/javascript"
    data-idzone="1234567"
    data-sub="123456"
    src="https://a.examplesite.com/video-outstream.js" async
></script>
```

{% endcode %}

## Mobile <a href="#mobile" id="mobile"></a>

## Mobile Banner <a href="#mobile-banner" id="mobile-banner"></a>

### Asynchronous Script <a href="#asynchronous-script-3" id="asynchronous-script-3"></a>

Added `data-sub` = 123456780

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://a.examplesite.com/ads.js"></script>
<ins class="adsbynetwork" data-zoneid="3553853" data-sub="123456780"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}

### iFrame <a href="#iframe-2" id="iframe-2"></a>

Added `&sub`=123456

{% code overflow="wrap" expandable="true" %}

```html
<iframe src="//a.examplesite.com/iframe.php?idzone=1234567&size=300x250&sub=123456" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
```

{% endcode %}

## Mobile Popunder <a href="#mobile-popunder" id="mobile-popunder"></a>

### Inline + Remote Script <a href="#inline--remote-script-1" id="inline--remote-script-1"></a>

Added `sub`: 123456

{% code overflow="wrap" expandable="true" %}

```html
<script type="application/javascript">
(function() {

    //version 1.0.0

    var adConfig = {
        "ads_host": "a.examplesite.com",
        "syndication_host": "syndication.examplesite.com",
        "idzone": 1234567,
        "popup_fallback": false,
        "popup_force": false,
        "chrome_enabled": true,
        "new_tab": false,
        "frequency_period": 720,
        "frequency_count": 1,
        "trigger_method": 3,
        "trigger_class": "",
        "only_inline": false,
        "sub": "123456" 
    }; 
```

{% endcode %}

### Remote Script Only <a href="#remote-script-only-1" id="remote-script-only-1"></a>

Added `ad_sub` = 123456

{% code overflow="wrap" expandable="true" %}

```html
<script type="application/javascript">
    var ad_idzone = "1234567",
    ad_popup_fallback = false,
    ad_popup_force = false,
    ad_chrome_enabled = true,
    ad_new_tab = false,
    ad_frequency_period = 720,
    ad_frequency_count = 1,
    ad_trigger_method = 3,
    ad_sub = 123456;
</script>
<script type="application/javascript" src="https://a.examplesite.com/popunder1000.js"></script>
```

{% endcode %}

## Mobile Instant Message <a href="#mobile-instant-message" id="mobile-instant-message"></a>

Added `data-sub` = 123456

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://ads.examplesite.com/ad-provider.js"></script>
<ins class="adsbynetwork" data-zoneid="1234567" data-sub="123456"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}

## Mobile Fullpage Interstitial <a href="#mobile-fullpage-interstitial" id="mobile-fullpage-interstitial"></a>

Added `data-sub` = 123456

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://ads.examplesite.com/ad-provider.js"></script>
<ins class="adsbynetwork" data-zoneid="1234567" data-sub="123456"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}

## Native <a href="#native" id="native"></a>

### Recommendation Widget <a href="#recommendation-widget" id="recommendation-widget"></a>

Added `data-sub` = 123456

{% code overflow="wrap" expandable="true" %}

```html
<script type="application/javascript" data-idzone="1234567" data-sub="123456" src="https://a.examplesite.com/nativeads.js" ></script>
```

{% endcode %}

## Push Notification <a href="#push-notification" id="push-notification"></a>

This format does not currently support the use of Sub IDs.

## Multi-Format <a href="#multi-format" id="multi-format"></a>

Added `data-sub`="123456"

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://a.examplesite.com/ad-provider.js"></script>
<ins class="adsbynetwork" data-zoneid="4278920" data-sub="123456"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}


---

# 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://docs.exads.com/publishers/sites-and-zones/subids.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.
