diff --git a/acquia_agent/acquia_agent.module b/acquia_agent/acquia_agent.module
index b689ca9..d7fa7bb 100644
--- a/acquia_agent/acquia_agent.module
+++ b/acquia_agent/acquia_agent.module
@@ -213,19 +213,26 @@ function acquia_agent_init() {
       drupal_set_message($text, 'status', FALSE);
     }
   }
+}
 
-  $request = ltrim(request_uri(), DIRECTORY_SEPARATOR);
+/**
+ * Implementation of hook_page_build().
+ */
+function acquia_agent_page_build(&$page) {
   $hide_signup_messages = variable_get('acquia_agent_hide_signup_messages', 0);
-  if (!$hide_signup_messages &&
-    (arg(0) != 'overlay-ajax') && (arg(3) != 'acquia-agent') &&
-    empty($_POST) &&  user_access('administer site configuration') &&
-    (!acquia_agent_has_credentials()) &&
-    (strpos($request, variable_get('file_public_path', conf_path() . DIRECTORY_SEPARATOR . 'files')) !== 0)) {
-    $text = 'Sign up for Acquia Cloud Free, a free Drupal sandbox to experiment with new features, test your code quality, and apply continuous integration best practices. Check out the <a href="!acquia-free">epic set of dev features and tools</a> that come with your free subscription.<br/>If you have an Acquia Network subscription, <a href="!settings">connect now</a>. Otherwise, you can turn this message off by disabling the Acquia Network modules.';
+
+  // Display a signup message to administrators if the site isn't connected to
+  // the Acquia Network.
+  if (!$hide_signup_messages && user_access('administer site configuration') && !acquia_agent_has_credentials()) {
+    $message = '';
+    $message .= t('Sign up for Acquia Cloud Free, a free Drupal sandbox to experiment with new features, test your code quality, and apply continuous integration best practices. Check out the <a href="!acquia-free">epic set of dev features and tools</a> that come with your free subscription.<br/>', array('!acquia-free' => url('https://www.acquia.com/acquia-cloud-free')));
+    $message .= t('If you have an Acquia Network subscription, <a href="!settings">connect now</a>. Otherwise, you can turn this message off by disabling the Acquia Network modules.', array('!settings' => url('admin/config/system/acquia-agent/setup')));
+
+    // Use a shorter message for websites that are members of a site group.
     if (isset($_SERVER['AH_SITE_GROUP'])) {
-      $text = '<a href="!settings">Connect your site to the Acquia Network now</a>. <a href="!more">Learn more</a>.';
+      $message = t('<a href="!settings">Connect your site to the Acquia Network now</a>. <a href="!more">Learn more</a>.', array('!settings' => url('admin/config/system/acquia-agent/setup')));
     }
-    $message = t($text, array('!acquia-free' => url('https://www.acquia.com/acquia-cloud-free'), '!settings' => url('admin/config/system/acquia-agent/setup')));
+
     drupal_set_message($message, 'warning', FALSE);
   }
 }
