Class: Analytical::Modules::Quantcast
- Inherits:
-
Object
- Object
- Analytical::Modules::Quantcast
- Includes:
- Base
- Defined in:
- lib/analytical/modules/quantcast.rb
Instance Attribute Summary
Attributes included from Base
#command_store, #initialized, #options, #tracking_command_location
Instance Method Summary collapse
- #init_javascript(location) ⇒ Object
-
#initialize(options = {}) ⇒ Quantcast
constructor
A new instance of Quantcast.
Methods included from Base
#init_location, #init_location?, #process_queued_commands, #protocol, #queue
Constructor Details
#initialize(options = {}) ⇒ Quantcast
Returns a new instance of Quantcast.
6 7 8 9 |
# File 'lib/analytical/modules/quantcast.rb', line 6 def initialize(={}) super @tracking_command_location = [:head_append, :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 44 45 |
# File 'lib/analytical/modules/quantcast.rb', line 11 def init_javascript(location) init_location(location) do case location.to_sym when :head_append js = <<-HTML <!-- Analytical Head Init: Quantcast --> <script type="text/javascript"> var _qevents = _qevents || []; (function() { var elem = document.createElement('script'); elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js"; elem.async = true; elem.type = "text/javascript"; var scpt = document.getElementsByTagName('script')[0]; scpt.parentNode.insertBefore(elem, scpt); })(); </script> HTML js when :body_append js = <<-HTML <!-- Analytical Body Init: Quantcast --> <script type="text/javascript"> _qevents.push( { qacct:"#{[:key]}"} ); </script> <noscript> <div style="display: none;"><img src="//pixel.quantserve.com/pixel/#{[:key]}.gif" height="1" width="1" alt="Quantcast"/></div> </noscript> HTML js end end end |