> For the complete documentation index, see [llms.txt](https://mobkoi.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mobkoi.gitbook.io/docs/header-bidding/header-bidding-pre-bid.js.md).

# Prebid JS

### Table of Contents

1. [Prerequisites](#prerequisites)
2. [Cookie Synchronization Options](#cookie-synchronization-options)
3. [User ID Module Integration](#user-id-module-integration)
   * [Key Benefits](#key-benefits-user-id)
   * [Building Prebid.js Package](#building-prebidjs-package-user-id)
   * [Configuration](#configuration-user-id)

### Prerequisites

Before starting the integration, ensure that all of the [prerequisites](/docs/publisher-integrations/readme.md) have been completed, In addition, the following Pre Bid modules are required.

### Configuration

#### Building Prebid.js Package

Include the following Mobkoi module, adapter, and their dependencies in your Prebid.js package build.

**Required Modules:**

* `mobkoiBidAdapter`
* `mobkoiIdSystem`
* `consentManagementTcf`
* `userId`
* `tcfControl`

**Build Command:**

```bash
gulp build --modules=consentManagementTcf,tcfControl,userId,mobkoiBidAdapter,mobkoiIdSystem
```

#### Configuration

```javascript
const adUnits = [
  {
    code: 'banner-ad',
    mediaTypes: {
      banner: { sizes: [[300, 600]] },
    },
    bids: [
      {
        bidder: 'mobkoi',
        params: {
          placementId: '<-- Placement ID provided by Mobkoi -->',
        },
      },
    ],
  },
];

pbjs.que.push(function () {
  // Configuration to leverage the User ID module on the client side.
  // This helps maximising demand opportunities.
  pbjs.setConfig({
    userSync: {
      userIds: [
        {
          name: 'mobkoiId',
          storage: {
            type: 'cookie',
            name: '_mobkoi_id',
            expires: 30, // days
          },
        },
      ],
    },
  });

  pbjs.addAdUnits(adUnits);
});
```

Replace the placementId value with the actual ID provided by Mobkoi. Once configured, this will enable Mobkoi to participate in the header bidding auction for the specified ad unit.
