You are here

function optimizely_init in Optimizely 7

Same name and namespace in other branches
  1. 6 optimizely.module \optimizely_init()
  2. 7.3 optimizely.module \optimizely_init()
  3. 7.2 optimizely.module \optimizely_init()

Implements hook_init().

File

./optimizely.module, line 28
Optimizely module

Code

function optimizely_init() {

  // Grab the ID, but only proceed if it's set to something.
  $optimizely_id = variable_get('optimizely_id', 'NONE');
  $optimizely_onoff = variable_get('optimizely_onoff', 'on');
  if ($optimizely_onoff == 'on' && $optimizely_id != "NONE") {
    $optimizely_script = '//cdn.optimizely.com/js/' . $optimizely_id . '.js';
    drupal_add_js($optimizely_script, 'external');
  }
}