--- googleanalytics.module 2010-09-14 22:52:35.000000000 +0100 +++ googleanalyticsNew.module 2010-09-23 09:44:17.000000000 +0100 @@ -131,6 +131,18 @@ function googleanalytics_footer($main = $url_custom = '"/404.html?page=" + document.location.pathname + document.location.search + "&from=" + document.referrer'; } + // hook_googleanalytics_custom_url + $url_custom_replace = module_invoke_all('googleanalytics_custom_url'); + if (!empty($url_custom_replace)) { + $url_custom = join(' ', $url_custom_replace); + + } + + // hook_googleanalytics_push_commands + // allow modules to add command arrays via _gaq.push(); + // see http://code.google.com/apis/analytics/docs/gaJS/gaJSApi_gaq.html#_gaq.push + $push_commands = module_invoke_all('googleanalytics_push_commands'); + // Add any custom code snippets if specified. $codesnippet_before = variable_get('googleanalytics_codesnippet_before', ''); $codesnippet_after = variable_get('googleanalytics_codesnippet_after', ''); @@ -149,6 +161,11 @@ function googleanalytics_footer($main = if (!empty($codesnippet_before)) { $script .= $codesnippet_before; } + if (!empty($push_commands)) { + foreach ($push_commands as $command) { + $script .= "_gaq.push([$command]);"; + } + } if (empty($url_custom)) { $script .= '_gaq.push(["_trackPageview"]);'; }