Hi,

First of all, many thanks for your work on this terrific module. I've been very impressed with it's development over the last 18 months.

I would like to request a feature where it is possible to track the number of page impressions for a panel (just like you can have with nodes).

This would be very usseful for creating stats and reports for my site.

Thanks again,
Danielle

Comments

razevedo’s picture

Issue tags: +statistics

Hello,

I wanted this feature too, it's very usefull as i'm using this module to build a lot of pages in my site.
Thanks very much for Panels module.

to Dinis: You are using some workaround to achive this?

dinis’s picture

Hi Razevdo,

My work-around is a bit of a bodge really. I've created a new table in my database with a row for each panel variant I have. I have an embedded php script on each variant which updates the "hit" value for the variant each time the script is run (i.e. on each page load).

It's very "quick and dirty" and ideally I would like to tie it into the main watchdog tracker / stats etc.

Kind regards,
Danielle

razevedo’s picture

Hi Danielle, thanks for the reply

I'll implement something like your workaround while we don't have the "clean" solution.
I expect that someone give a look to this one.

Thanks again,
Rafael

merlinofchaos’s picture

Project: Panels » Chaos Tool Suite (ctools)
Version: 6.x-3.1 » 6.x-1.1

This probably wouuld be more of a CTools feature for the page manager.

merlinofchaos’s picture

Actually, that workaround isn't *too far* from the appropriate solution.

The best solution is to module after statistics.module. For reference, this is how statistics tracks:

/**
 * Implementation of hook_exit().
 *
 * This is where statistics are gathered on page accesses.
 */
function statistics_exit() {
  global $user, $recent_activity;

  drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);

  if (variable_get('statistics_count_content_views', 0)) {
    // We are counting content views.
    if ((arg(0) == 'node') && is_numeric(arg(1)) && arg(2) == '') {
      // A node has been viewed, so update the node's counters.
      db_query('UPDATE {node_counter} SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d', time(), arg(1));
      // If we affected 0 rows, this is the first time viewing the node.
      if (!db_affected_rows()) {
        // We must create a new row to store counters for the new node.
        db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES (%d, 1, 1, %d)', arg(1), time());
      }
    }
  }
  if ((variable_get('statistics_enable_access_log', 0)) && (module_invoke('throttle', 'status') == 0)) {
    // Log this page access.
    db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", strip_tags(drupal_get_title()), $_GET['q'], referer_uri(), ip_address(), $user->uid, session_id(), timer_read('page'), time());
  }
}

So the access log can track total hits. Creating something similar to node_counter for variants would not be too difficult, and you can use page_manager_get_current_page() to see if a page was hit and which handler was used, etc. An initial version of this module wouldn't take too long, though to be truly useful it probably also needs integration.

I'm unsure if such a module should actually ship with page manager or if page_manager_statistics should be a separate module.

Does anyone want to work on this? If I'm handed a working module I may well consider including it.

japerry’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing this issue as outdated as Drupal 6 ctools is not supported. If this issue is relevant for Drupal 7, feel free to re-open and mark for Drupal 7 (or 8)