Getting Started


To get started with Cookie Control, you first need to create an account with CIVIC UK and register the website domain(s) that you wish to use with Cookie Control.

This will generate an associated apiKey and product specific to your choice of licence, for example:

const config = {
  apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  product: 'XXX'
};

This is the only information strictly required within your configuration for the module to load, though there are various API options available to personalise appearance and behaviour.

Anchor point for Loading Cookie Control Loading Cookie Control

The core functionality is packaged as a simple JavaScript module that you can either reference directly within your site's HTML, or manage via official and community plugins should you use a CMS.

This getting started guide assumes you have chosen to manually add Cookie Control, which requires adding a script element at an appropriate place in your document.

Technically, this can be where you deem most convenient, though since Cookie Control does not attempt to surface any user interface before the page has completely loaded, we suggest adding the reference just before the site's closing </body> tag.

The easiest way to load Cookie Control is by referencing the latest stable version directly from our CDN:

<!-- Latest Stable Version -->
<script src="https://cc.cdn.civiccomputing.com/9/cookieControl-9.x.min.js" type="text/javascript"></script>

<!-- For a list of all available versions, please see the CookieControl Changelog -->
CMS modules are available for Drupal 8.x/Drupal 9.x, Joomla 3.x and Wordpress 4.x

Anchor point for Beginning your configuration Beginning your configuration

Site specific behaviour and configuration is defined as a JavaScript Object - like the one shown at the start of this article containing information relating to choice of licence.

The configuration object may contain as many properties as you deem necessary - the only properties strictly required are apiKey and product.

This means you already have everything in place for a simple test scenario and simply need to connect the two prior steps by passing your site specific configuration as an argument to the module's main load() function, which becomes available as one of the module's API Methods under the namespace CookieControl.

You are welcome to edit and run the above configuration in JS Fiddle, though please be aware the detailed licence has been configured to authorise the JS Fiddle domain and is likely to break if either the apiKey or product properties are changed.

Anchor point for Configuration options Configuration options

Cookie Control allows you to control nearly every aspect of what it does - from informing your users of the types of cookies used, through to customising the appearance and text.

Sensible defaults will exist for a lot of these properties, so you generally only need to include those properties that you'd like to overwrite. The exception to this are apiKey and product as these properties are specific to your choice of licence.

With this in mind, we recommend new users think of the available options as fitting into two categories:

Consent and cookie options:
Options relating to the type of compliance required, the granularity of controls presented to the user and how user preferences should be stored.
Personalisation options:
Options relating to the language and presentation of the user interface.

While personalisation options help Cookie Control blend in with the look and feel of your site, they largely serve as a convenient means for promoting positive user experiences and may be thought of as entirely optional.

Legal compliance such as GDPR and CCPA is achievable with customisation of the consent and cookie options alone, so we recommend first focusing on this aspect of your configuration.