Browse Source

send islandora search terms to GA

master
ppound 3 years ago
parent
commit
5a598222be
  1. 7
      googleanalytics.module

7
googleanalytics.module

@ -180,12 +180,13 @@ function googleanalytics_page_alter(&$page) {
}
// Site search tracking support.
if (module_exists('search') && variable_get('googleanalytics_site_search', FALSE) && arg(0) == 'search' && $keys = googleanalytics_search_get_keys()) {
// UPEI changes use arg(1) and arg(2) instead of arg(0) and arg(1) and get rid of no-results
if (module_exists('search') && variable_get('googleanalytics_site_search', FALSE) && arg(1) == 'search' && $keys = arg(2)) {
// hook_preprocess_search_results() is not executed if search result is
// empty. Make sure the counter is set to 0 if there are no results.
$url_custom = '(window.googleanalytics_search_results) ? ' . drupal_json_encode(url('search/' . arg(1), array('query' => array('search' => $keys)))) . ' : ' . drupal_json_encode(url('search/' . arg(1), array('query' => array('search' => 'no-results:' . $keys, 'cat' => 'no-results'))));
$url_custom = drupal_json_encode(url('search/' . arg(2), array('query' => array('search' => $keys))));
}
// END UPEI changes
// If this node is a translation of another node, pass the original
// node instead.
if (module_exists('translation') && variable_get('googleanalytics_translation_set', 0)) {

Loading…
Cancel
Save