Class: Analytical::Modules::ClickTale

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/analytical/modules/click_tale.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 = {}) ⇒ ClickTale

Returns a new instance of ClickTale.



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

def initialize(options={})
  super
  @tracking_command_location = [:body_prepend, :body_append]
end

Instance Method Details

#init_javascript(location) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/analytical/modules/click_tale.rb', line 11

def init_javascript(location)
  init_location(location) do
    case location.to_sym
      when :body_prepend
        js = <<-HTML
        <!-- Analytical Init: ClickTale Top part -->
        <script type="text/javascript">
        var WRInitTime=(new Date()).getTime();
        </script>
        <!-- ClickTale end of Top part -->
        HTML
        js
      when :body_append
        js = <<-HTML
        <!-- Analytical Init: ClickTale Bottom part -->
    		<div id="ClickTaleDiv" style="display: none;"></div>
    		<script type='text/javascript'>
    		document.write(unescape("%3Cscript%20src='"+
    		 (document.location.protocol=='https:'?
    		  'https://clicktale.pantherssl.com/':
    		  'http://s.clicktale.net/')+
    		 "WRb6.js'%20type='text/javascript'%3E%3C/script%3E"));
    		</script>
    		<script type="text/javascript">
    		var ClickTaleSSL=1;
    		if(typeof ClickTale=='function') ClickTale(#{@options[:project_id]},#{@options[:site_traffic]},"www");
    		</script>
    		<!-- ClickTale end of Bottom part -->
        HTML
        js
    end
  end
end