Customize Captcha Text Length

MTCaptcha defaults to the range of 4 - 8 characters for the captcha text length. The actual captcha text length shown to each user is based on the risk score calculated by the Risk Engine.

MTCaptcha supports 2 different methods to customize and change the captcha length:

  • MT Admin to set the general minimum and maximum characters of each site.
  • JavaScript Configuration to set the specific captcha character length on render.

Set Minimum and Maximum Characters Using MT Admin

The minimum and maximum number of captcha characters can be customized per site using MT Admin > Sites settings, with a select-able range of 3- 10 characters. The actual captcha length seen by each user within this range will be based on the risk score calculated by MTCaptcha’s Risk Engine.  

set min-max.png

Set Captcha Length Using JavaScript Configuration

The captcha character size can also be customized at widget render time by using the ‘textLength’ javascript config params. eg:

  <script>
  var mtcaptchaConfig = {
        ...
        "textLength": 10,
        };
  </script>  

This advanced JavaScript config is Disabled by Default. and must be explicitly enabled via MT Admin > Sites setting ‘JS Config Captcha Text Length’.  

mt admin configure enable js text legnth

When this javascript config is used, one can check on the server side the actual textLength presented to the user via an additional json property ‘tokeninfo.textLength’ in the JSON returned by the checktoken API.  

  {
    "success": true,
    "tokeninfo": {
     ...
      "textLength": 5
    }
  }

For more on how to call the checktoken API and its JSON response, see Developers Guide - Validate MTCaptcha Success Token