Class: Analytical::Modules::Hubspot

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

Returns a new instance of Hubspot.



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

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

Instance Method Details

#init_javascript(location) ⇒ Object



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

def init_javascript(location)
  init_location(location) do
    js = <<-HTML
    <!-- Analytical Init: Hubspot -->
    <script type="text/javascript" language="javascript">
    var hs_portalid=#{options[:portal_id]};
    var hs_salog_version = "2.00";
    var hs_ppa = "#{options[:domain]}";
    document.write(unescape("%3Cscript src='" + document.location.protocol + "//" + hs_ppa + "/salog.js.aspx' type='text/javascript'%3E%3C/script%3E"));
    </script>
    HTML
    js
  end
end