Class: Analytical::Modules::Performancing

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

Returns a new instance of Performancing.



6
7
8
9
# File 'lib/analytical/modules/performancing.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
# File 'lib/analytical/modules/performancing.rb', line 11

def init_javascript(location)
  init_location(location) do
    js = <<-HTML
    <!-- Analytical Init: Performancing Metrics -->
		<script type="text/javascript">
		var clicky = { log: function(){ return; }, goal: function(){ return; }};
		var clicky_site_id = #{options[:site_id]};
		(function() {
		  var s = document.createElement('script');
		  s.type = 'text/javascript';
		  s.async = true;
		  s.src = ( document.location.protocol == 'https:' ? 'https://pmetrics.performancing.com' : 'http://pmetrics.performancing.com' ) + '/js';
		  ( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
		})();
		</script>
	  <!-- End Performancing Metrics -->
    HTML
    js
  end
end