Sign inSign up

Adding category scripts

Choose the category

Open Scripts. Statistics, Marketing and Other each have their own settings and HEAD section / Body section tabs. There is no Necessary script editor in the current interface.

Add an integration

  1. Choose Statistics, Marketing or Other according to the service’s purpose.
  2. Select HEAD section or Body section.
  3. Paste the JavaScript or script tags.
  4. Review Default state for scripts.
  5. Save changes and remove duplicate installations elsewhere.
  6. Test rejection, acceptance and withdrawal.

The former Enable scripts checkbox has been removed. Configured snippets remain subject to visitor consent. HEAD and Body share category consent; selecting HEAD does not allow execution before consent. Remove the configured code if you no longer want it installed.

Default state

Default state for scripts controls the initial category selection in the interface. Enabled does not grant effective consent or run the code before the visitor saves a choice. A saved visitor preference takes precedence. The initial default is Disabled.

Permissions and dependencies

Only users with unfiltered_html permission can save executable snippets. If editing is unavailable, ask the site administrator to check your permissions. Do not place the same library in multiple categories. Test integrations with dependencies and any code that another plugin injects after page load.

Statistics fields

The Statistics group uses category ID statistics. HEAD section and Body section accept JavaScript or script tags and are empty by default.

Default state for scripts offers Disabled or Enabled, default Disabled. Enabled preselects the category; scripts still wait for Accept. A saved visitor choice takes precedence. Both placements share this choice. There is no separate Enable scripts checkbox.

Save with Save Changes and test both consent states. Do not duplicate the same loader in both placements.

Marketing fields

The Marketing group uses category ID marketing. HEAD section and Body section accept JavaScript or script tags and are empty by default.

Default state for scripts offers Disabled or Enabled, default Disabled. Enabled preselects the category; scripts still wait for Accept. A saved visitor choice takes precedence. Both placements share this choice. There is no separate Enable scripts checkbox.

Save with Save Changes and test both consent states. Do not duplicate the same loader in both placements.

Other fields

The Other group uses category ID other. HEAD section and Body section accept JavaScript or script tags and are empty by default.

Default state for scripts offers Disabled or Enabled, default Disabled. Enabled preselects the category; scripts still wait for Accept. A saved visitor choice takes precedence. Both placements share this choice. There is no separate Enable scripts checkbox.

Save with Save Changes and test both consent states. Do not duplicate the same loader in both placements.

Accepted code and examples

Enter raw JavaScript or complete script tags. A URL on its own is not a valid loader. These fields are not general HTML editors: if script tags are supplied, CookieWP extracts those tags; ordinary divs, iframe markup and noscript content are not a substitute for executable JavaScript here. PHP is not executed.

Example external script, using a placeholder URL that you must replace:

<script src="https://example.com/analytics.js"></script>

Example inline JavaScript:

console.log('Statistics category accepted');

The example logs a message for testing; it is not an analytics installation. Supported executable script types are text/javascript, application/javascript and module. CookieWP stores the scripts inert and releases them after permission. Use manual integration for embeds and custom loaders.

Cookie inventory field

The JSON editor at the bottom of Scripts is separate from executable code. It documents cookies; it does not create or block them. Its full format and validation are covered in Cookie inventory & scan results.