diff --git a/googleanalytics.admin.inc b/googleanalytics.admin.inc
index 6ca377a..39ad86f 100644
--- a/googleanalytics.admin.inc
+++ b/googleanalytics.admin.inc
@@ -365,6 +365,24 @@ function googleanalytics_admin_settings_form(&$form_state) {
     '#description' => t("Code in this textarea will be added <strong>after</strong> _gaq.push(['_trackPageview']). This is useful if you'd like to track a site in two accounts."),
   );
 
+  $form['advanced']['codesnippet']['googleanalytics_codesnippet_pageurl'] = array(
+    '#type' => 'textfield',
+    '#title' => t('URL for tracking pageviews (optional)'),
+    '#default_value' => variable_get('googleanalytics_codesnippet_pageurl', ''),
+    '#size' => 60,
+    '#maxlength' => 60,
+    '#required' => TRUE,
+    '#description' => t('Optional parameter to indicate what page URL to track
+      metrics under. When using this option, use a beginning slash (/) to
+      indicate the page URL. The main use-case is including query strings and
+      hashes in pageviews using the following JavaScript in this field: %script.
+      <a href="@analytics">Find more information in the documentation</a>. This
+      value will be overridden on certain pages if you use the "Track internal
+      search" and "Track translation sets as one unit" options above.',
+      array('@analytics' => 'http://code.google.com/apis/analytics/docs/gaJS/gaJSApiBasicConfiguration.html#_gat.GA_Tracker_._trackPageview',
+            '%script' => '(location.pathname + location.search + location.hash)')),
+  );
+
   /* hook_footer() is not able to add code to head. Upgrade to D7 required.
   $form['advanced']['googleanalytics_js_scope'] = array(
     '#type' => 'select',
diff --git a/googleanalytics.module b/googleanalytics.module
index e03b706..de98f67 100644
--- a/googleanalytics.module
+++ b/googleanalytics.module
@@ -130,8 +130,16 @@ function googleanalytics_footer($main = 0) {
       }
     }
 
-    // Site search tracking support.
+    // Override the url being tracked.
     $url_custom = '';
+
+    // Get the custom pageview url if specified.
+    $pageview_url =    variable_get('googleanalytics_codesnippet_pageurl', '');
+    if ($pageview_url) {
+      $url_custom = filter_xss($pageview_url);
+    }
+
+    // Site search tracking support.
     if (module_exists('search') && variable_get('googleanalytics_site_search', FALSE) && arg(0) == 'search' && $keys = search_get_keys()) {
       $url_custom = '(window.googleanalytics_search_results) ? ' . drupal_to_js(url('search/'. arg(1), array('query' => 'search='. drupal_urlencode($keys)))) . ' : ' . drupal_to_js(url('search/'. arg(1), array('query' => 'search=no-results:'. drupal_urlencode($keys) .'&cat=no-results')));
     }
