You are here

function simpleads_pure_stats in SimpleAds 7.2

Load non-aggregated advertisement statistics.

1 call to simpleads_pure_stats()
simpleads_node_load in includes/node.inc
Implements hook_node_load().

File

includes/helper.inc, line 47
Helper functions.

Code

function simpleads_pure_stats($nid) {
  $result = db_query("SELECT\n    COUNT(si.nid) AS impressions,\n    COUNT(DISTINCT si.ip_address) AS unique_impressions,\n    COUNT(sc.nid) AS clicks,\n    COUNT(DISTINCT sc.ip_address) AS unique_clicks\n    FROM {simpleads_impressions} si\n    JOIN {simpleads_clicks} sc ON sc.nid = si.nid\n    WHERE si.nid = :nid", array(
    ':nid' => $nid,
  ))
    ->fetchObject();
  return $result;
}