You are here

function hook_google_analytics_counter_query_alter in Google Analytics Counter 7.3

Same name and namespace in other branches
  1. 8.3 google_analytics_counter.api.php \hook_google_analytics_counter_query_alter()

Alter Select query before it gets executed

Here you can customize the select query which writes into the proper storage table the number of pageviews for each node

Parameters

SelectQuery $query: Query builder for SELECT statements.

1 invocation of hook_google_analytics_counter_query_alter()
google_analytics_counter_update_storage in ./google_analytics_counter_data.inc
Get pageviews for nodes and write them either to the Drupal core table node_counter, or to the google_analytics_counter_storage table. This function is triggered by hook_cron().

File

./google_analytics_counter.api.php, line 17
Hooks provided by the Google Analytics Counter module.

Code

function hook_google_analytics_counter_query_alter(&$query) {

  // e.g. Restrict node pageview storage to node type: blog
  $query
    ->condition('type', 'blog', 'LIKE');
}