Fetching latest commit…
Cannot retrieve the latest commit at this time
|Failed to load latest commit information.|
Google Analytics Custom Variables by Ben Buckman @ NewLeafDigital.com This module allows arbitrary/custom variables to be tracked with Google Analytics. (These variables can then be queried using the Google Analytics API.) Related modules: - Google Analytics API - http://drupal.org/project/google_analytics_api - (for reading the tracked data) - Google Analytics Counter - http://drupal.org/project/google_analytics_counter - tracks page stats using the URL/alias as a proxy (not nid directly as this module does) - Google Analytics Importer - http://drupal.org/project/ga_importer - similar to Counter but no code released yet Documentation on custom variables: http://code.google.com/intl/en/apis/analytics/docs/tracking/gaTrackingCustomVariables.html * How to utilize for your own custom variables: This module provides a hook, hook_ga_customvars_define, to define the variable keys. There are 5 slots available, nid is set by default to the 1st slot. Then use ga_customvars_set() to set the values. (Similar to the way tokens are defined.) * * * * * * * * * * * * * * * * * * * * Implementation notes: Can use 2 approaches: 1. Use existing googleanalytics_codesnippet_before variable output in googleanalytics_footer() - (append to $GLOBALS['conf']['googleanalytics_codesnippet_before]) - pros: existing mechanism - cons: messy use of variables 2. Add additional inline JS to footer - pros: cleaner (?) - cons: need to re-check if page has analytics -- going w/ #1 for now Not dealing with: - async (_gaq) / sync script - GA module uses old sync, will stick with that Variables to set (5 available) 1. nid for node pages (empty on non-node pages) 2. uid for logged in users (empty for anon) 3-5. [custom, set w/ hook] Possible future direction: - use Context API (w/ a GA namespace) for vars? ...probably overkill - ...