---
# System prepended metadata

title: Remote Ad Unit Integration

---

# Remote Ad Unit Integration

**Tag Manager**
Need to insert the tag manager just after the opening `<body>` element.
```
<script>
    (function(w, d, s, r,i) {w[r] =w[r] || function() {(w[r].q = w[r].q || []).push(arguments)};
    w[r].l = 1 * new Date();var a = d.createElement(s),m = d.getElementsByTagName(s)[0]
    ;a.async = 1;a.src = 'http://localhost:8080/nextclick.js?id='+i;m.parentNode.insertBefore(a, m);
    })(window, document, 'script', 'nxtag', [ENTER_PROPERTY_ID]);
    nxtag('config',[ENTER_PROPERTY_ID])
    nxtag('track', 'page_view')
</script>
```

**Page Zone**
This goes anywhere within the body. We still use it so the ad manager can pull the data it needs.
```
<div class="adsbynext" data-ad-zone="[ENTER_ZONE_ID]" data-ad-type="remote"></div>
```

In order to actually start the ad unit you need to fire an ad trigger. For a remote ad unit its likely this will actually go inside your js bundle.

```javascript=
nxtag('ad', {
    onReady:function(nxt) {
      // use nxt toolkit here...  
    })
})
```

**Ad toolkit**
This is the structure of the toolkit that gets passed into the onReady funtion.
```
toolkit {
    clickId: 8926806
    identity: <identity object>
    impressionId: 5637124
    optIn: <optIn function>
    placements: [<placements>]
    publisherId: "724b95fd-28c5-46e0-829b-b5bd2b113f7b"
    slots: 2
    trackImpression: <track impression function>
    zoneId: "375379"
}
```

**Placement**
Here is the structure of the placement object
```
placement {
    accompanied_html: null
    advertiserId: "c92db5cc-4747-47a7-9f10-35800deee2c2"
    alt_text: "cid=71e1aa42-8a16-40c3-b508-e6d276994138;advertiserId=c92db5cc-4747-47a7-9f10-35800deee2c2;redirect=false"
    banner_id: "519749189"
    body: null
    campaignId: "71e1aa42-8a16-40c3-b508-e6d276994138"
    cid: "71e1aa42-8a16-40c3-b508-e6d276994138"
    height: "300"
    image_url: "https://s3.us-east-2.amazonaws.com/creatives.nextclick.io/coreg_sample.png"
    key: "519749189"
    position: 1
    redirect: "false"
    redirect_url: "https://serve.nextclick.io/redirect.spark?MID=174048&plid=997482&setID=375379&channelID=0&CID=322076&banID=519749189&PID=0&textadID=0&tc=1&mt=1568316999501913&spr=1&hc=c883c264090a2e11a23b3d1bbe50f342fac0e111&location="
    refresh_time: ""
    refresh_url: ""
    target: null
    tracking_pixel: null
    width: "250"
}
```