The Clerk.io Developer Hub

Welcome to the Clerk.io developer hub.

This is site is only technical specification for developers.

You'll find comprehensive guides and documentation to help you start working with Clerk.io at our Help Center

Get Started    

Configuration

How to alter the settings of Clerk.js.

Configuring Clerk.js

Clerk.js is configured by default

If you use one of your plugins, or copy-paste the tracking code from my.clerk.io, Clerk.js is already configured.

This is only for if you need more advanced customisation.

The object can be configured by the Clerk('config',' ') method with the following options as a object parameter:

Option
Purpose

key

Your store's public API key.

debug.enable

Should the Clerk.js debugger be enabled. Defaults to true.

debug.level

What level of events should be logged by the debugger. The options are error (only errors), warn (errors and warnings) and log (all type of messages).

debug.ui

Toggles the UI debugger that might be easier to use than the browser's console for non-developers. Defaults to off.

debug.record

Enables to record debug messages across page views. This can significantly help to debug a flow of actions. Defaults to no.

visitor

The visitor's visitor id. This will be auto-generated by default.

language

Global configuration of the language to be used if applying multiple languages. This will be auto detected by default from the page's language meta information.

collect_email

true if Clerk.js should automatically detect emails from input fields, else false. This is used for ie. abandoned basket and other personalized emails. falseby default.

filters

A mapping of custom template filters

globals

A mapping of custom values that should be available in all Templates.

Multiple configuration calls will only update the given configuration options and leave the others intact
When adding or editing configurations, it takes a dictionary as follows:.

Clerk('config', {
  key: 'YOUR_API_KEY',
  debug: {
    enable: true,
    level: 'log',
    ui: true,
    record: true
  },
  visitor: 'ABC123',
  language: 'spanish',
  collect_email: true,
  filters: {
    format_price: function(price) {
      return price.toFixed(2).toString();
    },
    uppercase: function(string) {
    	return string.toUpperCase();
    }
  },
  globals: {
  	currency_symbol: '$'
  }
});

Clerk can also be configured for live testing by using url parameters. Using a # at the end of url and clerkjs: you can change all elements of the configuration. For example, the debugger can be enabled by entering #clerkjs:debug.ui=on at the end of the url address.