Class: Analytical::Modules::Adroll

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

Returns a new instance of Adroll.



6
7
8
9
# File 'lib/analytical/modules/adroll.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
25
26
27
28
29
30
31
32
33
34
# File 'lib/analytical/modules/adroll.rb', line 11

def init_javascript(location)
  init_location(location) do
    js = "    <!-- Analytical Init: Adroll -->\n    <script type=\"text/javascript\">\n    adroll_adv_id = \"\#{options[:adv_id]}\";\n    adroll_pix_id = \"\#{options[:pix_id]}\";\n    (function () {\n    var oldonload = window.onload;\n    window.onload = function(){\n       __adroll_loaded=true;\n       var scr = document.createElement(\"script\");\n       var host = ((\"https:\" == document.location.protocol) ? \"https://s.adroll.com\" : \"http://a.adroll.com\");\n       scr.setAttribute('async', 'true');\n       scr.type = \"text/javascript\";\n       scr.src = host + \"/j/roundtrip.js\";\n       document.documentElement.firstChild.appendChild(scr);\n       if(oldonload){oldonload()}};\n    }());\n    </script>\n    HTML\n    js\n  end\nend\n"