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