Class: Analytical::Modules::Optimizely

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/analytical/modules/optimizely.rb

Instance Attribute Summary

Attributes included from Base

#command_store, #initialized, #options, #tracking_command_location

Instance Method Summary collapse

Methods included from Base

#init_location, #init_location?, #process_queued_commands, #protocol, #queue

Constructor Details

#initialize(options = {}) ⇒ Optimizely

Returns a new instance of Optimizely.



6
7
8
9
# File 'lib/analytical/modules/optimizely.rb', line 6

def initialize(options={})
  super
  @tracking_command_location = :head_prepend
end

Instance Method Details

#init_javascript(location) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/analytical/modules/optimizely.rb', line 11

def init_javascript(location)
  init_location(location) do
    js = <<-HTML
    <!-- Analytical Init: Optimizely -->
    <script type="text/javascript">document.write(unescape("%3Cscript src='"+document.location.protocol+"//cdn.optimizely.com/js/#{options[:key]}.js' type='text/javascript'%3E%3C/script%3E"));</script>
    HTML
    js
  end
end