You are here

analytics_google.module in Analytics 7

Same filename and directory in other branches
  1. 8 analytics_google/analytics_google.module

File

analytics_google/analytics_google.module
View source
<?php

/**
 * Implememts hook_hook_info().
 */
function analytics_google_hook_info() {
  $info['analytics_google_universal_actions'] = array(
    'group' => 'analytics',
  );
  $info['analytics_google_universal_actions_alter'] = array(
    'group' => 'analytics',
  );
  $info['analytics_google_ga_actions'] = array(
    'group' => 'analytics',
  );
  $info['analytics_google_ga_actions_alter'] = array(
    'group' => 'analytics',
  );
  return $info;
}

/**
 * Implements hook_theme().
 */
function analytics_google_theme() {
  $info['analytics_google_universal_js'] = array(
    'variables' => array(
      'actions' => array(),
      'service' => NULL,
    ),
    'file' => 'analytics_google.theme.inc',
  );
  $info['analytics_google_ga_actions_js'] = array(
    'variables' => array(
      'actions' => array(),
      'service' => NULL,
    ),
    'file' => 'analytics_google.theme.inc',
  );
  $info['analytics_google_ga_js'] = array(
    'variables' => array(
      'service' => NULL,
    ),
    'file' => 'analytics_google.theme.inc',
  );
  return $info;
}

/**
 * Implements hook_analytics_service_info().
 */
function analytics_google_analytics_service_info() {
  $info['google_universal'] = array(
    'label' => t('Google Universal (analytics.js)'),
    'class' => 'GoogleUniversalAnalyticsService',
    'multiple' => TRUE,
  );
  $info['google_ga'] = array(
    'label' => t('Google Analytics (ga.js)'),
    'class' => 'GoogleAnalyticsGaService',
    'multiple' => TRUE,
  );
  return $info;
}
function _analytics_google_validate_id($element, &$form_state) {
  $value = $element['#value'];
  if ($value == '') {
    return;
  }
  elseif (!preg_match('/^UA\\-\\d+\\-\\d+$/', $value)) {
    form_error($element, t('%name is not in a valid format.', array(
      '%name' => $element['#title'],
    )));
  }
}

Functions