Enabling adaptive content
Choose an authentication method to pass user data to GitBook.
To start customizing your documentation experience for your readers, you'll need to enable adaptive content and decide how your visitor data is passed to GitBook. This lets your site's content dynamically adapt based on who's viewing it.
Enable adaptive content
Before you’re able to pass user data to GitBook, you’ll need to configure your site to use adaptive content.
Head to your site’s settings, and enable “Adaptive content” from your site’s audience settings. Once enabled, you’ll get a generated “Visitor token signing key”, which you’ll need in order to continue the adaptive content setup.
Set your adaptive schema
After enabling adaptive content, you’ll need to define a schema for the types of claims you expect GitBook to receive when a user visits your site.
The adaptive content schema should reflect how these claims are structured when sent to GitBook.
For example, if you expect a visitor to potentially be a beta user in your product, you would set an adaptive schema similar to:
{
"type": "object",
"properties": {
"isBetaUser": {
"type": "boolean",
"description": "Whether the visitor is a Beta user."
},
},
"additionalProperties": false
}
This will also help you use autocomplete when configuring your claims in the condition editor.
Set an unsigned claim
If you intend to work with unsigned claims, you will need to declare the claims you are expecting in the schema under an “unsigned” prop alongside your signed claims.
{
"type": "object",
"properties": {
"isBetaUser": {
"type": "boolean",
"description": "Whether the visitor is a Beta user."
},
// Add unsigned claims
"unsigned": {
"type": "object",
"description": "Unsigned claims of the site visitor.",
"properties": {
"language": {
"type": "string",
"description": "The language of the visitor",
"enum": [
"en",
"fr",
"it"
]
}
},
"additionalProperties": false
}
}
"additionalProperties": false
}
Pass visitor data to GitBook
GitBook provides different ways to pass visitor data to adapt your site's content. After defining your schema, you’ll need to decide how you want to pass your visitor data to GitBook.
Last updated
Was this helpful?