This repository has been archived by the owner on Aug 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 92
/
click_tale.rb
47 lines (44 loc) · 1.55 KB
/
click_tale.rb
1
2
3
4
5
6
7
8
9
10
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
44
45
46
47
module Analytical
module Modules
class ClickTale
include Analytical::Modules::Base
def initialize(options={})
super
@tracking_command_location = [:body_prepend, :body_append]
end
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/')+
"#{@options[:script_name] || "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]},\"#{@options[:www_param] || 'www'}\");
</script>
<!-- ClickTale end of Bottom part -->
HTML
js
end
end
end
end
end
end