diff --git a/googleanalytics.module b/googleanalytics.module index 5e4efa58a908b56afbb677bee0e5f0ef2cf2064c..6c73734d0554d75e6f9946b27a44d1594d000acf 100644 --- a/googleanalytics.module +++ b/googleanalytics.module @@ -80,7 +80,7 @@ function googleanalytics_footer($main = 0) { // Add any custom code snippets if specified $codesnippet = variable_get('googleanalytics_codesnippet', ''); - return '"; + return '"; } } @@ -172,4 +172,25 @@ function googleanalytics_admin_settings() { '#description' => t('Paste custom code snippets here. These will be added to every page that Google Analytics appears on. For help with this feature see the cutroni.com blog. Do not include the <script> tags, and always end your code with a semicolon (;).', array('@snippets' => 'http://drupal.org/node/39282', '@blog' => 'http://cutroni.com/blog/') ) ); return system_settings_form($form); +} + +/** + * Implementation of hook_requirements(). + */ +function googleanalytics_requirements($phase) { + $requirements = array(); + + if ($phase == 'runtime') { + // Raise warning if Google user account has not been set yet. + if (variable_get('googleanalytics_account', 'UA-') == 'UA-') { + $requirements['googleanalytics'] = array( + 'title' => t('Google Analytics module'), + 'description' => t('Google Analytics module has not been configured yet. Please configure its settings from the Google Analytics settings page.', array('@url' => url('admin/settings/googleanalytics'))), + 'severity' => REQUIREMENT_ERROR, + 'value' => t('Not configured'), + ); + } + } + + return $requirements; } \ No newline at end of file