How to install Cookie Consent

The easiest way to get Cookie Consent up and running is to use our wizard. Most people should use that.

If you’re a little more hardcore, this guide is for you.


You can download the latest build from GitHub or via Bower. To install via Bower, use:

bower install --save cookieconsent2


Include cookieconsent.js on your page like so:

<!-- Minified Cookie Consent served from our CDN -->
<script src="//"></script>


To customise the Cookie Consent plugin, you can provide an options object before including it.

    window.cookieconsent_options = {
        learnMore: 'More info',
        link: ''
<script src="//"></script>

On the fly

You can customize Cookie Consent options on the fly (once it is loaded) by calling:

    learnMore: 'Learn more'


These are the options you can pass to Cookie Consent.

message (string)

Default: ‘This website uses cookies to ensure you get the best experience on our website’

The message shown by the plugin.

dismiss (string)

Default: ‘Got it!’

The text used on the dismiss button.

learnMore (string)

Default: ‘More info’

The text shown on the link to the cookie policy (requires the link option to also be set)

link (string)

Default: null

The url of your cookie policy. If it’s set to null, the link is hidden.

container (string: CSS selector)

Default: null

The element you want the Cookie Consent notification to be appended to. If null, the Cookie Consent plugin is appended to the body.

Note: the majority of our built in themes are designed around the plugin being a child of the body.

theme (string)

Default: ‘light-floating’

The theme you wish to use. Can be any of the themes from the style directory, e.g. dark-top.

If you wish to use your own CSS instead, specify the URL of your CSS file. e.g. styles/my_custom_theme.css. This can be a relative or absolute URL.

To stop Cookie Consent from loading CSS at all, specify false.

path (string)

Default: ‘/’

The path for the consent cookie that Cookie Consent uses, to remember that users have consented to cookies. Use to limit consent to a specific path within your website.

domain (string)

Default: The current subdomain

The domain for the consent cookie that Cookie Consent uses, to remember that users have consented to cookies. Useful if your website uses multiple subdomains, e.g. if your script is hosted at you might override this to, thereby allowing the same consent cookie to be read by subdomains like

expiryDays (integer)

Default: 365

The number of days Cookie Consent should store the user’s consent information for.

target (string)

Default: _self

The target of the link to your cookie policy. Use to open a link in a new window, or specific frame, if you wish.