0

I am working with the Google Analytics (googleanalytics) module in Drupal 7 and I need to get search categories added to the code. The module itself doesn't seem to offer any hooks in for an operation like this. I am considering trying to go into the storage of drupal_add_js to modify it. But I don't like how hacky that is.

So my next thought is to modify the module. But I would rather not do this to a contrib module. So any thoughts? I have been also wondering if I can push _trackPageview twice to Google on the same page, with the second time being with the search query and category. But I don't know how Google Analytics will work with that option.

0

If your question is "how to pass custom values to Google Analytics ?", then why wouldn't you use the Custom Variables feature of Google Analytics, populated by custom tokens ?

  1. Create custom token containing search categories (via hook_token_info() and hook_tokens())
  2. In Google Analytics Module interface, in the "Custom Variables" fieldset, add your custom token
  • No, Google Analytics has a fairly new feature that goes along with their search settings. Now instead of just passing a search term to GA you can also pass a search category. This is completely separate from custom variables. – Patrick Jan 2 '13 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.