Class: Analytical::Modules::Performancing
- Inherits:
-
Object
- Object
- Analytical::Modules::Performancing
- 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
- #init_javascript(location) ⇒ Object
-
#initialize(options = {}) ⇒ Performancing
constructor
A new instance of Performancing.
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(={}) 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 = "<!-- Analytical Init: Performancing Metrics -->\n<script type=\"text/javascript\">\nvar clicky = { log: function(){ return; }, goal: function(){ return; }};\nvar clicky_site_id = \#{options[:site_id]};\n(function() {\nvar s = document.createElement('script');\ns.type = 'text/javascript';\ns.async = true;\ns.src = ( document.location.protocol == 'https:' ? 'https://pmetrics.performancing.com' : 'http://pmetrics.performancing.com' ) + '/js';\n( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );\n})();\n</script>\n<!-- End Performancing Metrics -->\n" js end end |