> For the complete documentation index, see [llms.txt](https://blueeast.gitbook.io/bluerain-os/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blueeast.gitbook.io/bluerain-os/guides/plugins/configuration.md).

# Configuration

Some times plugins may need to have custom configurations for each different usage. For example, a Google Analytics plugin will need a custom Tracking ID which will be different in each project.

## Usage

Plugins can be configured in the `config.plugins` object, where `config` is the object that is passed to the `boot` method.

So to configure the Google Analytics plugin create an object at `config.plugins[${slug}]` where `slug` is the plugin's slug.

To find out what configurations a plugin needs, please refer to the plugin documentation.

## Context

Plugin `initialize` functions get BlueRain context as second params.

## Accessing configurations inside Plugin

The plugin specific configurations are passed to the initialize method of the plugin class at system boot time.

```javascript
import { Plugin } from 'bluerain-os';

class GoogleAnalyticsPlugin extends Plugin {

    initialize(config, ctx) {
        // use config here
    }
}
```

## Example Usage

To use the Google Analytics plugin, first create a `plugins` file (or edit your existing one), and import the plugin. For this plugin we are use the custom key `'google-analytics'`.

```javascript
const googleAnalyticsPlugin = require('bluerain-plugin-google-analytics');

module.exports = [googleAnalyticsPlugin]
```

Now create a new `config.js` file (or edit your existing one) and put the following content in this file:

```javascript
module.exports = {
    plugins: {
        'google-analytics': {
            'tracking-id': 'GOOGLE_ANALYTICS_TRACKING_ID'
        }
    }
}
```

Note that we used the same custom key here to reference the plugin.

At last, boot your client with the plugin:

```javascript
import BR from '@blueeast/bluerain-os';

const config = require('./config');
const plugins = require('./plugins');

BR.boot({ config, plugins });
```


---

# 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://blueeast.gitbook.io/bluerain-os/guides/plugins/configuration.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.
