diff --git a/googleanalytics.module b/googleanalytics.module
index ab1afcb..cf590a8 100644
--- a/googleanalytics.module
+++ b/googleanalytics.module
@@ -255,6 +255,16 @@ function googleanalytics_page_alter(&$page) {
     if (!empty($codesnippet_before)) {
       $script .= $codesnippet_before;
     }
+
+    // Allow modules to implement a hook_ga_custom_url() fucntion so that they
+    // can override $url_custom.
+    foreach (module_implements('ga_custom_url') as $module) {
+      $func = $module.'_ga_custom_url';
+      if ($url_custom = $func()) {
+        break;
+      }
+    }
+
     if (empty($url_custom)) {
       $script .= '_gaq.push(["_trackPageview"]);';
     }
