You are here

function crazyegg_admin_settings_form in Crazy Egg Integration 7

Same name and namespace in other branches
  1. 6 includes/admin.inc \crazyegg_admin_settings_form()

Crazy Egg module admin settings form. Used to toggle Crazy Egg status and to set account ID.

1 string reference to 'crazyegg_admin_settings_form'
crazyegg_menu in ./crazyegg.module
Implements hook_menu(). Adds `Crazy Egg` link on the "admin/config" page for easier access to this module

File

includes/admin.inc, line 12
Drupal admin settings form for Crazy Egg module.

Code

function crazyegg_admin_settings_form() {
  $form = array();

  // each field name matches variable name where the field value will be stored
  $form['crazyegg_enabled'] = array(
    '#type' => 'radios',
    '#title' => t('Crazy Egg Enabled?'),
    '#options' => array(
      TRUE => t('Yes'),
      FALSE => t('No'),
    ),
    '#default_value' => variable_get('crazyegg_enabled', TRUE),
  );
  $form['crazyegg_account_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Crazy Egg Account ID'),
    '#attributes' => array(
      'placeholder' => t('e.g. 00111111'),
    ),
    '#default_value' => variable_get('crazyegg_account_id', ''),
    '#description' => t('This is your numerical CrazyEgg account ID, it is 8 digits long.<br />' . 'The easiest way to find it is by logging in to your CrazyEgg account.<br />' . 'Click on Account. Under your profile and email address, you’ll see your account number.'),
  );
  $form['advanced_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('More settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['advanced_settings']['crazyegg_js_scope'] = array(
    '#type' => 'radios',
    '#title' => t('Location to add the tracking script'),
    '#description' => t('Controls where on the page the tracking script is added'),
    '#default_value' => variable_get('crazyegg_js_scope', 'header'),
    '#options' => array(
      'header' => t('Header <em>(recommended)</em>'),
      'footer' => t('Footer'),
    ),
  );
  $form['advanced_settings']['crazyegg_roles_excluded'] = array(
    '#type' => 'checkboxes',
    '#options' => user_roles(),
    '#title' => t('Excluded roles (optional)'),
    '#default_value' => variable_get('crazyegg_roles_excluded', array()),
    '#description' => t('You can control which visits and clicks are tracked in Crazy Egg by excluding roles.<br />' . 'For example, if you have traffic generated by employees, it’s difficult to distinguish visits' . 'from your visitors versus those visits from your own employees.<br />' . 'To prevent internal traffic (i.e. administrators) from diluting your data, select "administrator."'),
  );
  $form['advanced_settings']['crazyegg_paths'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages to track (optional)'),
    '#default_value' => variable_get('crazyegg_paths', ''),
    '#description' => t('By default, Crazy Egg will track all pages within your domain.<br />' . 'Need to track specific pages instead of all pages? You can specify which pages you\'d like to track ' . 'by providing the path (everything after .com). Include one path per line. For example,' . '<pre>  home/about<br />  posts<br />  posts/*<br />  users/*/details</pre>'),
    '#cols' => 100,
    '#rows' => 5,
    '#resizable' => FALSE,
    '#required' => FALSE,
    '#weight' => 40,
  );
  $form['crazyegg_help'] = array(
    '#type' => 'item',
    '#markup' => t('<strong>Support:</strong> <a href="mailto:support@crazyegg.com">support@crazyegg.com</a><br />' . '<strong>Website: </strong><a href="https://www.crazyegg.com" target="_blank">https://www.crazyegg.com</a>'),
  );
  return system_settings_form($form);
}