> 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/additional-subids.md).

# Using Additional Sub IDs

As explained in [Using Sub IDs](https://docs.exads.com/publishers/sites-and-zones/subids.md), you use Sub IDs as a Publisher to segment your traffic, for example by traffic source. This information then appears in the **Statistics** tab, in the **Sub IDs** sub-tab.

As well as this, there are two more parameters that are essentially the exact same as 'sub' overall: 'sub2' and 'sub3'.

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

### Asynchronous Script <a href="#asynchronous-script-banner-sticky-banner-instant-message-mobile-instant-message-desktop-fullpage-int" id="asynchronous-script-banner-sticky-banner-instant-message-mobile-instant-message-desktop-fullpage-int"></a>

(Banner, Mobile Banner, Sticky Banner, Instant Message, Mobile Instant Message, Desktop Fullpage Interstitial, Mobile Fullpage Interstitial, Video Slider, Outstream Video, Recommendation Widget, Push Notification, In-Page Push Notification, Multi-Format)

Added `data-sub` = XXXXXX, `data-sub2` = XXXXXX and `data-sub3` = XXXXXX

{% 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="XXXXXX" data-sub2="XXXXXX" data-sub3="XXXXXX"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

{% endcode %}

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

Added `&sub`= XXXXXX, `&sub2`= XXXXXX and `&sub3`= XXXXXX

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

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

{% endcode %}

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

**(Inline + Remote Script)**

Added `sub` = XXXXXX, `sub2` = XXXXXX and `sub3` = XXXXXX to adConfig

{% code expandable="true" %}

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

    //version 12.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": "",
    "trigger_delay": 0,
    "capping_enabled": true,
    "tcf_enabled": false,
    "agego_cross_site_enabled": true,
    "only_inline": false,
    "sub": "XXXXXX",
    "sub2": "XXXXXX",
    "sub3": "XXXXXX"
};

// Ad script runtime from the generated tag goes here, unchanged
})();

</script>
```

{% endcode %}

**(Remote Script Only)**

Added `ad_sub` = XXXXXX, `ad_sub2` = XXXXXX and `ad_sub3` = XXXXXX

```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_trigger_delay = 0,
    ad_capping_enabled = true;
    var ad_sub = "XXXXXX";
    var ad_sub2 = "XXXXXX";
    var ad_sub3 = "XXXXXX";
</script>
<script type="application/javascript" src="https://a.examplesite.com/popunder1000.js"></script>
```

## RTB <a href="#rtb" id="rtb"></a>

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

```json
&sub=XXXXXX
&sub2=XXXXXX
&sub3=XXXXXX
{
   "id": "d4b5c697-41f3-4c1c-a3d5-5fd01b5ef2aa",
   "imp": [
       {
           "id": "974090632",
           "banner": {
               "w": 300,
               "h": 250
           }
       }
   ],
   "site": {
       "id": "12345",
       "domain": "sitedomain.com",
       "cat": ["IAB1-4"],
       "page": "https://examplesite.com/page"
   },
   "device": {
       "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
       "ip": "192.0.2.1",
       "geo": {
           "country": "IRL"
       },
       "language": "en",
       "os": "Linux & UNIX",
       "js": 0,
       "ext": {
           "remote_addr": "192.0.2.1",
           "x_forwarded_for": "",
           "accept_language": "en-GB;q=0.8,pt-PT;q=0.6,en;q=0.4,en-US;q=0.2,de;q=0.2,es;q=0.2,fr;q=0.2"
       }
   },
   "user": {
       "id": "57592f333f8983.043587162282415065"
   },
   "ext": {
       "sub": 1221,
       "sub2": 2222,
       "sub3": 3333
   }
}
```

{% endcode %}

These parameters could be used to segment the traffic even more. Unlike sub, they do not appear in the **Sub IDs** sub-tab of the **Statistics** tab. They are registered internally. The only way to get the data for these metrics is through the API Global Routes for Publishers — the `POST /statistics/publisher/global` route. You can find this route in your network's API documentation (for example, `https://api.examplesite.com/v2/docs/`).

Here are two examples of how the request should look in order to pull data from sub2 and sub3 respectively:

### Grouping by sub2 and sub3 <a href="#grouping-by-sub2-and-sub3" id="grouping-by-sub2-and-sub3"></a>

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

```json
{
  "count": 0,
  "detailed": 0,
  "timezone": "Europe/Dublin",
  "totals": 1,
  "filter": {
    "date_from": "2019-11-07",
    "date_to": "2019-11-07",
     "zone_id": [
      1234567
    ]
  },
  "group_by": [
    "sub2",
    "sub3"
  ],
  "order_by": [
    {
      "field": "impressions",
      "order": "desc"
    }
  ],
  "projection": [
    "base"
  ],
  "limit": 25,
  "offset": 0
}
```

{% endcode %}

### Filtering and Grouping by sub2 and sub3 <a href="#filtering-and-grouping-by-sub2-and-sub-3" id="filtering-and-grouping-by-sub2-and-sub-3"></a>

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

```json
{
  "count": 0,
  "detailed": 0,
  "timezone": "Europe/Dublin",
  "totals": 1,
  "filter": {
    "date_from": "2019-11-07",
    "date_to": "2019-11-07",
    "sub": [
      10001
    ],
    "sub2":[
      10002
    ],
    "sub3":[
      10003
    ],
    "zone_id": [
      1234567
    ]
  },
  "group_by": [
    "sub2",
    "sub3"
  ],
  "order_by": [
    {
      "field": "impressions",
      "order": "desc"
    }
  ],
  "projection": [
    "base"
  ],
  "limit": 25,
  "offset": 0
}
```

{% endcode %}

{% hint style="info" %}
**Note**: You can only group by two dimensions. To add `sub`, remove one of the other two. Otherwise the request returns an error.
{% endhint %}

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

```json
{
  "message": "Request `group_by` data is invalid."
}
```

{% 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.exads.com/publishers/sites-and-zones/additional-subids.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
