You are here

function piwik_stats_field_schema in Piwik Statistic Integration 7.2

Implements hook_field_schema().

This defines the database schema of the piwik statistical field.

File

./piwik_stats.install, line 22
Installation file of piwik statistical field module.

Code

function piwik_stats_field_schema($field) {
  $schema = array(
    'description' => 'Stores statistical piwik data.',
    'columns' => array(
      'nb_visits' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Unique pageviews.',
      ),
      'nb_hits' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Overall pageviews.',
      ),
      'entry_nb_visits' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Number of visits that started on a node.',
      ),
      'entry_nb_actions' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Number of page views for visits that started on that node.',
      ),
      'entry_sum_visit_length' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Time spent, in seconds, by visits that started on this node.',
      ),
      'entry_bounce_count' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Number of visits that started on this node and bounced (viewed only one page).',
      ),
      'exit_nb_visits' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Number of visits that finished on this node.',
      ),
      'sum_time_spent' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Total time spent on this node, in seconds.',
      ),
      'bounce_rate' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Ratio of visitors leaving the website after landing on this node (in percent).',
      ),
      'exit_rate' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Ratio of visitors that do not view any other page after this node (in percent).',
      ),
    ),
    'indexes' => array(
      'visits' => array(
        'nb_visits',
        'entry_nb_visits',
        'exit_nb_visits',
      ),
      'hits' => array(
        'nb_hits',
        'entry_nb_actions',
      ),
      'rate' => array(
        'bounce_rate',
        'exit_rate',
      ),
    ),
  );
  return $schema;
}