You are here

function adsense_click_log in Google AdSense integration 6

Same name and namespace in other branches
  1. 5.3 contrib/adsense_click/adsense_click.logs.inc \adsense_click_log()
  2. 5 adsense.module \adsense_click_log()
  3. 5.2 adsense.module \adsense_click_log()
  4. 7 contrib/adsense_click/adsense_click.logs.inc \adsense_click_log()

Click log.

1 string reference to 'adsense_click_log'
adsense_click_menu in contrib/adsense_click/adsense_click.module
Implementation of hook_menu().

File

contrib/adsense_click/adsense_click.logs.inc, line 11
Functions to display the logs tracked by the adsense_click module.

Code

function adsense_click_log() {
  $header = array(
    array(
      'data' => t('Timestamp'),
      'field' => 'timestamp',
      'sort' => 'desc',
    ),
    array(
      'data' => t('Path'),
      'field' => 'path',
    ),
    array(
      'data' => t('IP/Host'),
      'field' => 'ip',
    ),
    array(
      'data' => t('Referrer'),
      'field' => 'referrer',
    ),
  );
  $name_resolve = variable_get('adsense_click_tracking_name_resolve', ADSENSE_CLICK_TRACKING_NAME_RESOLVE_DEFAULT);
  $sql = 'SELECT * FROM {adsense_clicks} ' . tablesort_sql($header);
  $result = pager_query($sql, 50);
  while ($log = db_fetch_object($result)) {
    if ($name_resolve) {
      $host = gethostbyaddr($log->ip);
    }
    else {
      $host = $log->ip;
    }
    $rows[] = array(
      array(
        'data' => format_date($log->timestamp, 'small'),
        'nowrap' => 'nowrap',
      ),
      _adsense_click_format_path($log->path, $log->title),
      l($host, 'http://whois.domaintools.com/' . $log->ip),
      _adsense_click_format_path($log->referrer),
    );
  }
  return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
}