> For the complete documentation index, see [llms.txt](https://docs.exoclick.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.exoclick.com/api/ja/guang-gao-pei-zhi-api/ad-plac-request.md).

# リクエスト

Ad Placement API は、次のいずれからでも呼び出せます **クライアント** 側または **サーバー** 側。

を使用する場合、 **クライアント** 側の実装では、ブラウザが **プリフライト** リクエストを行う場合があります。これを避けたい場合は、リクエストヘッダーで `Content-Type: text/plain`。これにより、ブラウザはそのリクエストを「simple」と判断し、プリフライトリクエストをスキップします。

また、API を **クライアント** 側で呼び出す場合、 **IP は実際には必要ありません** フロントエンドと JavaScript では IP の検出が難しいためです。代わりに、当社の API はリクエスト時の接続から IP を検出します。

を使用する場合、 **サーバー** 側の実装では、正しいターゲティングを確実にするために、 **ユーザーの正しい IP を明示的に渡す必要があります**。そうしないと、広告はサーバーの所在地に基づいてターゲティングされ、後で IP の不一致によりインプレッションが無効になる可能性があります。

クライアント側かサーバー側かにかかわらず、IP が渡された場合は、当社が検出したものよりも優先されます。

ad placement API にリクエストを行うには、2 つのオブジェクトを渡す必要があります： **user** と **zones**。リクエストは HTTP POST を使用した JSON で送信されます。

## user

| パラメータ               | 必須？ | 説明                                                                                                                            |
| ------------------- | --- | ----------------------------------------------------------------------------------------------------------------------------- |
| id                  | いいえ | ユーザーの ID                                                                                                                      |
| ip                  | 推奨  | ユーザーの IP アドレス。                                                                                                                |
| ua                  | はい  | User Agent：ユーザーのブラウザ/アプリとデバイス/OS を含む文字列。                                                                                      |
| language            | いいえ | 次の [標準の 2 文字の ISO コード](https://www.andiamo.co.uk/resources/iso-language-codes/) に、任意の 2 文字の地域コードを加えて設定します。例： `en-us` 米国英語の場合。 |
| referer             | いいえ | 広告が表示されるサイトのアドレス。                                                                                                             |
| el                  | いいえ | ユーザーのメールアドレスを Base64 でエンコードしたもの。                                                                                              |
| screen\_resolution  | いいえ | ユーザーが使用するデバイスの画面解像度                                                                                                           |
| window\_orientation | いいえ | サイトがモバイルレイアウトの場合は「portrait」、デスクトップレイアウトの場合は「landscape」にしてください。                                                                |
| gdpr                | いいえ | プライバシーに関する推奨拡張項目（オブジェクト）。                                                                                                     |

### user.gdpr

| パラメータ   | 説明                                                                     |
| ------- | ---------------------------------------------------------------------- |
| gdpr    | これは **0** 呼び出し元がユーザーが GDPR の対象ではないと判断する場合は **1** 、ユーザーが GDPR の対象である場合は |
| consent | これは IAB 標準で必要とされる同意文字列です。                                              |

## zones

| パラメータ             | 必須？ | 説明                                                                                                                                                                    |
| ----------------- | --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id                | はい  | 広告ゾーンの ID                                                                                                                                                             |
| sub               | いいえ | 広告ゾーンの Sub ID                                                                                                                                                         |
| keywords          | いいえ | 任意の [keywords](/advertisers/campaigns/creating-a-campaign/create-campaign-step3.md#keywords) 特定の種類の広告に一致する可能性のあるトラフィックに関連付けられたキーワードです。キーワードがない場合は、サイトの URL が照合に使用されます |
| custom\_targeting | いいえ | カスタムゾーン値（オブジェクト）                                                                                                                                                      |

### zones.custom\_targeting

| パラメータ  | 説明                                                |
| ------ | ------------------------------------------------- |
| ex\_av | これは **0** 未定義の場合、 **1** 年齢確認済みの場合は **2** 年齢未確認の場合 |

## 例

1 回のリクエストで複数の広告ゾーンをリクエストできます。以下の例でわかるように、各ゾーンには異なる ID が割り当てられます。

```json
{
  "user": {
    "id": "abdef8u9",
    "ip": "10.42.0.1",
    "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.63 Safari/537.36",
    "language": "en-US",
    "referer": "https://blabla.com",
    "gdpr": {
      "gdpr": 1,
      "consent": "CPAoZRHPArq3hBcADBENBJCgAAAAAAAAAAqIHKQAAOUgAAAA"
    }
  },
  "zones": [
    {
      "id": 4031007,
      "sub": 111,
      "keywords": "humour, general"
    },
    {
      "id": 4031015,
      "sub": 222
    },
    {
      "id": 4031019,
      "sub": 222
    }
  ]
}
```


---

# 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.exoclick.com/api/ja/guang-gao-pei-zhi-api/ad-plac-request.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.
