Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Drupal module: Google Analytics Custom Variables
tag: 6.x-1.0-alpha2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
ga_customvars_lookup
README
ga_customvars.info
ga_customvars.install
ga_customvars.module

README

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.)


* * * * * * * * * * * * * * * * * * * 
The submodule ga_customvars_lookup loads the 'nid' custom variable created by default with ga_customvars
and populates the node_counter table as if it were from core node stats. 
See more details in the comments at the top of ga_customvars_lookup.module.

* * * * * * * * * * * * * * * * * * * 

* 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
    2. node type for node pages
    3-5. [custom, set w/ hook]
Something went wrong with that request. Please try again.