Install the plugin with npm:
$ npm install gitbook-plugin-adsense
Add it to the plugins array in book.json:
{
"plugins": ["adsense"]
}
You can set the Google Adsense client and slot keys using the plugins configuration in the book.json:
{
"plugins": ["adsense"],
"pluginsConfig": {
"adsense": {
"client": "ca-pub-XXXXXXXXXXXXXXXX",
"slot": "XXXXXXXXXX",
"format": "auto",
"element": ".page-inner section",
"position": "top"
}
}
}
Allowed values for positions are top
and bottom
, bottom being the default.