Class: TheTracker::Trackers::Uservoice

Inherits:
Base
  • Object
show all
Defined in:
lib/the_tracker/trackers/uservoice.rb

Instance Attribute Summary

Attributes inherited from Base

#active

Instance Method Summary collapse

Methods inherited from Base

#body_top

Constructor Details

#initialize(key_file, options) ⇒ Uservoice

AdForm info pm and id



7
8
9
10
11
# File 'lib/the_tracker/trackers/uservoice.rb', line 7

def initialize(key_file, options)
  @options  = options
  @key_file = key_file
  super()
end

Instance Method Details

#body_bottomObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/the_tracker/trackers/uservoice.rb', line 26

def body_bottom
  return if !active
  <<-EOF
    <script type="text/javascript">
    UserVoice = window.UserVoice || [];
    UserVoice.push(['showTab', 'classic_widget',
      #{@options.to_json}
    ]);
    </script>
  EOF
end

#headerObject



17
18
19
20
21
22
23
24
# File 'lib/the_tracker/trackers/uservoice.rb', line 17

def header
  return if !active
  <<-EOF
    <script type="text/javascript">
    (function(){var uv=document.createElement('script');uv.type='text/javascript';uv.async=true;uv.src='//widget.uservoice.com/#{@key_file}.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(uv,s)})()
    </script>
  EOF
end

#nameObject



13
14
15
# File 'lib/the_tracker/trackers/uservoice.rb', line 13

def name
  :uservoice
end