Index: googleanalytics.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.admin.inc,v retrieving revision 1.4.2.14 diff -u -p -r1.4.2.14 googleanalytics.admin.inc --- googleanalytics.admin.inc 22 Aug 2009 11:48:15 -0000 1.4.2.14 +++ googleanalytics.admin.inc 4 Sep 2009 13:42:01 -0000 @@ -212,6 +212,13 @@ function googleanalytics_admin_settings_ '#description' => t('If checked, your AdSense ads will be tracked in your Google Analytics account.'), '#default_value' => variable_get('googleanalytics_trackadsense', FALSE), ); + + $form['advanced']['googleanalytics_sendnode'] = array( + '#type' => 'checkbox', + '#title' => t('Include node id'), + '#description' => t('If checked, the URI that is send to Google Analytics will be changed to include the node id. The URI will look like: /content/url(node=1) in Google Analytics. This is usefull when the URLs are rewritten automaticly and don\'t include the node id anymore, and you want to search for the id in Google Analytics data.'), + '#default_value' => variable_get('googleanalytics_sendnode', FALSE), + ); $form['advanced']['codesnippet'] = array( '#type' => 'fieldset', Index: googleanalytics.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.module,v retrieving revision 1.19.2.11 diff -u -p -r1.19.2.11 googleanalytics.module --- googleanalytics.module 22 Aug 2009 10:51:25 -0000 1.19.2.11 +++ googleanalytics.module 4 Sep 2009 13:42:01 -0000 @@ -152,6 +152,17 @@ function googleanalytics_footer($main = // Add any custom code snippets if specified. $codesnippet_before = variable_get('googleanalytics_codesnippet_before', ''); $codesnippet_after = variable_get('googleanalytics_codesnippet_after', ''); + + // If the include node id option is switched on, then create an custom URL with the request URI and the node id attached as (node=1) + if(variable_get('googleanalytics_sendnode', FALSE) && empty($url_custom)){ + // Get the rewritten URL + $rewrittenURL = urldecode($_GET["q"]); + $matches = array(); + if(preg_match("/node[\/\=]([0-9]+)/", $rewrittenURL, $matches)) { + $nodeId = preg_replace("/[\\/\-]/", "=", $matches[0]); + $url_custom = '"' . $_SERVER["REQUEST_URI"]. '(' . $nodeId . ')"'; + } + } // Build tracker code for footer. $script = 'try{';