You are here

function __getclicky_output_js_code in Clicky - Web Analytics in Real Time 6

Same name and namespace in other branches
  1. 8 getclicky.module \__getclicky_output_js_code()
  2. 7 getclicky.module \__getclicky_output_js_code()
1 call to __getclicky_output_js_code()
getclicky_footer in ./getclicky.module
Implementation of hook_footer() to insert Javascript at the end of the page

File

./getclicky.module, line 272

Code

function __getclicky_output_js_code($site_id_number) {
  $js_code = '';
  if (variable_get('getclicky_show_banner_image', FALSE)) {
    $js_code .= __getclicky_output_banner_html_code($site_id_number);
  }

  /*     '#options' => array(
  0      t('When onto a https page - do not inject any js code. I do not have a Pro account and/or I do not want to track https pages.'),
  1      t('When onto a https page - use the js code for secure pages. I have a Pro account.'),
  2      t('When onto a https page - use the js code for normal http pages. I do not have a Pro account and I do not mind the mixed-content-warning.'),
      ),
  */

  // Are we on a secure page?
  if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
    $getclicky_secure_pages_tracking_option = variable_get('getclicky_secure_pages_tracking_option', 0);
    if ($getclicky_secure_pages_tracking_option == 0) {

      // do not inject
      $js_code .= '';
    }
    elseif ($getclicky_secure_pages_tracking_option == 1) {

      // https page and secure code
      $js_code .= __getclicky_output_js_code_secure_or_unsecure($site_id_number, 'secure');
    }
    elseif ($getclicky_secure_pages_tracking_option == 2) {

      // https page and unsecure code
      $js_code .= __getclicky_output_js_code_secure_or_unsecure($site_id_number, 'unsecure');
    }
  }
  else {

    // http page
    $js_code .= __getclicky_output_js_code_secure_or_unsecure($site_id_number, 'unsecure');
  }
  return $js_code;
}