diff --git a/src/Form/NodeViewCountSettingsForm.php b/src/Form/NodeViewCountSettingsForm.php
index ff93c0d..99faa3c 100644
--- a/src/Form/NodeViewCountSettingsForm.php
+++ b/src/Form/NodeViewCountSettingsForm.php
@@ -115,12 +115,11 @@ class NodeViewCountSettingsForm extends ConfigFormBase {
       '#options' => $this->getNodeViewModesOptions(),
       '#default_value' => $config->get('view_modes'),
     ];
-
     $form['user_roles'] = [
       '#title' => $this->t('User roles'),
       '#description' => $this->t('Choose user roles for counting node views.'),
       '#type' => 'checkboxes',
-      '#options' => $this->getRoleNamesOptions($config->get('excluded_user_roles')),
+      '#options' => !empty($config->get('excluded_user_roles')) ? $this->getRoleNamesOptions($config->get('excluded_user_roles')):$this->getAllRoleNamesOptions(),
       '#default_value' => $config->get('user_roles'),
     ];
 
@@ -128,10 +127,11 @@ class NodeViewCountSettingsForm extends ConfigFormBase {
       '#title' => $this->t('Excluded user roles'),
       '#description' => $this->t('Choose user roles which will be excluded from node views counting.'),
       '#type' => 'checkboxes',
-      '#options' => $this->getRoleNamesOptions($config->get('user_roles')),
+      '#options' => !empty($config->get('user_roles')) ? $this->getRoleNamesOptions($config->get('user_roles')):$this->getAllRoleNamesOptions(),
       '#default_value' => $config->get('excluded_user_roles'),
     ];
 
+
     $form['logs_life_time'] = [
       '#type' => 'select',
       '#title' => $this->t('Discard node views logs older than'),
@@ -215,6 +215,30 @@ class NodeViewCountSettingsForm extends ConfigFormBase {
     return $roles_options;
   }
 
+
+  /**
+   * Get all user role names on the site.
+   *
+   * Data returned in format applicable for '#options' key of form element.
+   * Keys are ids of role names, values are labels (human readable names)
+   * of roles.
+   *
+   * @return array
+   *   User role names.
+   *
+   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
+   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
+   */
+  private function getAllRoleNamesOptions() {
+    $roles_options = [];
+    /** @var \Drupal\user\RoleInterface[] $roles */
+    $roles = $this->entityTypeManager->getStorage('user_role')->loadMultiple();
+    foreach ($roles as $role_id => $role) {
+        $roles_options[$role_id] = $role->label();
+    }
+    return $roles_options;
+  }
+
   /**
    * Get logs lifetime options.
    *
