Can anyone help me with this, I want to activate time spent module on my custom form module, and store the time spent on a field on my form. I think that I could do it on the file timespent.module
here.
function time_spent_init() {
//if user has a role who is going to be tracked, add javascript code
if (time_spent_user_has_role()) {
$timer = variable_get('time_spent_timer', TIME_SPENT_TIMER);
$limit = variable_get('time_spent_limit', TIME_SPENT_LIMIT);
$mynide = -1; //false value
//checks if this is a node page. taxonomy or views pages won't be counted.
//confirm if this node type and user role will be tracked
$nodetypes = variable_get('time_spent_node_types', 'all');
if ($node = menu_get_object()) {
if (($nodetypes == 'all' || $nodetypes[$node->type] === $node->type )) {
$mynide = $node->nid;
}
}
drupal_add_js(drupal_get_path('module', 'time_spent') . '/time_spent.js');
drupal_add_js(array('time_spent' => array('timer' => check_plain($timer), 'limit' => check_plain($limit), 'nid' => $mynide, 'sectoken' => drupal_get_token())), 'setting');
}
}