Hook to get details of taxonomy term page
Taxonomy terms can also be loaded when you're not on a taxonomy page, so arg(2) will be empty, hence empty records. 

To fix:

$term = menu_get_object('taxonomy_term', 2);
if ($term) {
  db_insert('reporting_api')
    -&gt;fields(array(
      'tid' =&gt; $term-&gt;tid,
      'name' =&gt; $term-&gt;name,
      'vid' =&gt; $term-&gt;vid,
      'timestamp' =&gt; REQUEST_TIME,
    ))
    -&gt;execute();
}