Class: Analytical::Modules::Comscore

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

Returns a new instance of Comscore.



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

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

Instance Method Details

#init_javascript(location) ⇒ Object



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

def init_javascript(location)
  init_location(location) do
    js = <<-HTML
    <!-- Analytical Init: comScore -->
    <script>document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E"));</script>
    <script>COMSCORE.beacon({c1:2, c2:#{options[:key]}, c3:"", c4:"", c5:"", c6:"", c15:""});</script>
    <noscript><img src="http://b.scorecardresearch.com/p?c1=2&c2=#{options[:key]}&c3=&c4=&c5=&c6=&c15=&cj=1" /></noscript>
    HTML
    js
  end
end