# Configuration

## You have the Collective Audience™ SDK on your pages

If you correctly followed the [installation process to have the SDK on your pages](/sdk), you should have the following code in your HTML tree:

```markup
<script>
  window.beOpAsyncInit = function () {
    BeOpSDK.init({
      account: "YOUR_ACCOUNT_ID",
    });
    BeOpSDK.watch();
  };
</script>
<script async src="https://widget.collectiveaudience.co/sdk.js"></script>
```

### ➡ Add a new param to the Collective Audience™ SDK config

The `init` function allows you to set your account id. At the same place, you're now able to set the segments IDs you have about your users.

```markup
<script>
  window.beOpAsyncInit = function () {
    /** This part is your responsibility as a publisher
     * The code bellow is just an example of what can be done
     */
    const myDMPInfo = fetchMyDMPInfo(); // ["1234", "5678"]
    const myCRMInfo = fetchMyCRMInfo(); // ["logged", "premium"]
    const myOtherInfo = fetchMyOtherInfo(); // ["5_pages_in_a_row", "second_visit_today"]
    const mySegments = [].concat(myDMPInfo, myCRMInfo, myOtherInfo); // ["1234", "5678", "logged", "premium", "5_pages_in_a_row", "second_visit_today"]
    /** End of publisher responsibility */

    BeOpSDK.init({
      account: "YOUR_ACCOUNT_ID",
      bpsegs: mySegments, // ["1234", "5678", "logged", "premium", "5_pages_in_a_row", "second_visit_today"]
    });
    BeOpSDK.watch();
  };
</script>
<script async src="https://widget.collectiveaudience.co/sdk.js"></script>
```

### ➡ Update the values later

No worries if

* your Collective Audience™ SDK is loaded before you can access and deploy your segments on pages
* your segmentation changes during the user session

we provide a function to update the SDK `bpsegs` state called `__updateBeOpPublisherSegments` accepting in argument a string array.

> **info:** The `bpsegs` param can be ommited from the `BeOpSDK.init` function with no impact using the `__updateBeOpPublisherSegments` function.

```javascript
if (BeOpSDK) {
  BeOpSDK.__updateBeOpPublisherSegments([
    "YOUR",
    "UPDATED",
    "SEGMENTS",
    "IDS",
    "...",
  ]);
}
```

  


:::warning
The execution of `__updateBeOpPublisherSegments` function will cause a new call to our server to potentially update the creatives in the current page according to your campaigns setup. If you don't want to update your already filled slots, please see the [config of the **refreshExistingSlots** param](/sdk#beopsdkinitconfig) in your SDK.

:::

## You use Collective Audience™ through the Prebid adapter

If you correctly followed the [installation process for the Collective Audience™ Prebid adapter](/prebid), you should have the Collective Audience™ setup in your slot `bids` array

```javascript
var adUnits = [
  {
    code: "in-article",
    mediaTypes: {
      banner: {
        sizes: [[1, 1]],
      },
    },
    bids: [
      {
        bidder: "beop",
        params: {
          accountId: "YOUR_ACCOUNT_ID",
          currency: "EUR", // or "USD"
        },
      },
    ],
  },
];
```

### ➡ Update Collective Audience™ bidder request config

If you want to pass your first party data to Collective Audience™, you can set Collective Audience™ bidder `config.ortb2` object with one of the following options:

```json
{
  "site": {
    "ext": {
      "bpsegs": ["Your", 1, "ST", "party", "data"],
      "data": {
        "bpsegs": ["Your", 1, "ST", "party", "data"]
      }
    }
  },
  "user": {
    "ext": {
      "bpsegs": ["Your", 1, "ST", "party", "data"],
      "data": {
        "bpsegs": ["Your", 1, "ST", "party", "data"]
      }
    }
  }
}
```

You can choose the location between:

* `site.ext`
* `site.ext.data`
* `user.ext`
* `user.ext.data`

and add a new key: `bpsegs` which is waiting an array of something that will be convertible into a string. Our `**beOpBidAdapter**` will be able to find them.