> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/enabling-adaptive-content.md).

# 適応型コンテンツの有効化

ユーザーデータを GitBook に渡す認証方法を選択します。

読者向けにドキュメント体験をカスタマイズし始めるには、アダプティブコンテンツを有効にし、訪問者データを GitBook にどのように渡すかを決める必要があります。これにより、サイトのコンテンツは閲覧者に応じて動的に適応します。

### アダプティブコンテンツを有効にする

ユーザーデータを GitBook に渡せるようにする前に、サイトでアダプティブコンテンツを使用するよう設定する必要があります。

次へ進んで [サイトの設定](/docs/documentation/ja-gitbook-documentation/manage-your-site/site-settings.md)、そして有効にする **アダプティブコンテンツ** サイトのオーディエンス設定から。有効にすると、生成された「Visitor token signing key」が取得でき、これがアダプティブコンテンツの設定を続けるために必要になります。

<figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F5EeWAo5Ij6CKrp69uMl5%2F26_01_06_enable_adaptive_content%402x.png?alt=media&amp;token=4a1e8558-4b91-4f8b-8581-63d570a2c330" alt="A GitBook screenshot showing the enable adaptive content toggle"><figcaption><p>サイトの設定でアダプティブコンテンツを有効にする</p></figcaption></figure>

### ビジタースキーマを設定する

アダプティブコンテンツを有効にしたら、ユーザーがサイトを訪れたときに GitBook が受け取ると想定するクレームの種類について、スキーマを定義する必要があります。

ビジタースキーマは、これらのクレームが GitBook に送られる際の構造を反映している必要があります。

たとえば、訪問者が製品のベータユーザーである可能性があると想定する場合、次のようなビジタースキーマを設定します。

```json
{
  "type": "object",
  "properties": {
    "isBetaUser": {
      "type": "boolean",
      "description": "訪問者がベータユーザーかどうか。"
    }
  },
  "additionalProperties": false
}
```

これにより、クレームを設定する際にオートコンプリートも使いやすくなります [条件エディタ](/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/adapting-your-content.md#working-with-the-condition-editor)。ビジタースキーマでサポートされるのは以下の型のみです：

{% tabs %}
{% tab title="文字列" %}
文字列として渡されるクレームを読み取ります。

GitBook は動的文字列を受け付けます。つまり、ユーザー名や開発者トークンなどの文字列データを動的に渡せます。

文字列には **任意の enum** キーを含めることもでき、GitBook が受け取るデータを設定済みの値のいずれかに制限できます。

```json
{
  "type": "object",
  "properties": {
    "language": {
          "type": "string",
          "description": "訪問者の言語",
          // 任意の enum プロパティ
          "enum": [
            "en",
            "fr",
            "it"
          ]
  },
  "additionalProperties": false
}
```

{% hint style="warning" %}
動的文字列（enum キーなしで定義された文字列）は、次の場合にのみ受け入れられます [インライン式](/docs/documentation/ja-gitbook-documentation/kontentsuwosuru/variables-and-expressions.md#use-variables-in-your-content)。要素（ページ、セクション、ブロック）の表示条件式は、enum キーで定義された文字列でのみ機能します。
{% endhint %}
{% endtab %}

{% tab title="真偽値" %}
真偽値として渡されるクレームを読み取ります。

```json
{
  "type": "object",
  "properties": {
    "isBetaUser": {
      "type": "boolean",
      "description": "訪問者がベータユーザーかどうか。"
    },
  },
  "additionalProperties": false
}
```

{% endtab %}

{% tab title="オブジェクト" %}
関連する値をまとめるために、クレームをオブジェクトに入れ子で含めます。

```json
{
  // トップレベルのクレーム
  "type": "object",
  "properties": {
    // ネストされたクレーム
    "access": {
      "type": "object",
      "description": "ユーザーの製品機能へのアクセス",
      "properties": {
        "isAlphaUser": {
          "type": "boolean",
          "description": "訪問者が Alpha ユーザーかどうか。"
        },
        "isBetaUser": {
          "type": "boolean",
          "description": "訪問者がベータユーザーかどうか。"
        },
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

{% endtab %}
{% endtabs %}

### 署名なしクレームを設定する

署名なしクレームは、クライアントアプリケーションによって署名されていない可能性のある、受け渡されるクレームを識別する特定の種類のクレームです。ビジタースキーマでは、クレームを次のように設定する必要があります `署名なし` URL パラメーター、署名なし Cookie、機能フラグを通じてクレームを渡す場合。

署名なしクレームを扱う場合は、署名済みクレームと並べて、スキーマ内の「unsigned」プロップで期待するクレームを宣言する必要があります。

```json
{
  "type": "object",
  "properties": {
    "isBetaUser": {
      "type": "boolean",
      "description": "訪問者がベータユーザーかどうか。"
    },
    // 署名なしクレームを追加
    "unsigned": {
      "type": "object",
      "description": "サイト訪問者の署名なしクレーム",
      "properties": {
        "language": {
          "type": "string",
          "description": "訪問者の言語",
          // 任意の enum プロパティ
          "enum": [
            "en",
            "fr",
            "it"
          ]
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### 訪問者データを GitBook に渡す

GitBook では、サイトのコンテンツを適応させるために訪問者データを渡すさまざまな方法を用意しています。スキーマを定義したら、訪問者データを GitBook にどのように渡すかを決める必要があります。

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-cookie">:cookie:</i></td><td><strong>Cookie</strong></td><td>公開 Cookie または署名付き Cookie を通じて、訪問者データをドキュメントに渡します。</td><td><a href="/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/enabling-adaptive-content/cookies.md">Cookie</a></td></tr><tr><td><i class="fa-link">:link:</i></td><td><strong>URL</strong></td><td>URL のクエリパラメーターを通じて、訪問者データをドキュメントに渡します。</td><td><a href="/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/enabling-adaptive-content/url.md">URL</a></td></tr><tr><td><i class="fa-flag">:flag:</i></td><td><strong>機能フラグ</strong></td><td>機能フラグプロバイダーを通じて、訪問者データをドキュメントに渡します。</td><td><a href="/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/enabling-adaptive-content/feature-flags.md">機能フラグ</a></td></tr><tr><td><i class="fa-lock">:lock:</i></td><td><strong>認証アクセス</strong></td><td>認証プロバイダーを通じて、訪問者データをドキュメントに渡します。</td><td><a href="/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/enabling-adaptive-content/authenticated-access.md">認証済みアクセス</a></td></tr></tbody></table>


---

# 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://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/enabling-adaptive-content.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.
