class Raygun::JavaScriptTracker

Public Instance Methods

body_html() click to toggle source
# File lib/raygun/javascript_tracker.rb, line 18
def body_html
  return unless js_api_key?
  [
    '<script type="text/javascript">',
    "rg4js('apiKey', '#{js_api_key}');",
    "rg4js('enableCrashReporting', true);",
    '</script>'
  ].join('').html_safe
end
head_html() click to toggle source
# File lib/raygun/javascript_tracker.rb, line 5
def head_html
  return unless js_api_key?
  [
    '<script type="text/javascript">',
    '!function(a,b,c,d,e,f,g,h){a.RaygunObject=e,a[e]=a[e]||function(){',
    '(a[e].o=a[e].o||[]).push(arguments)},f=b.createElement(c),g=b.getElementsByTagName(c)[0],',
    'f.async=1,f.src=d,g.parentNode.insertBefore(f,g),h=a.onerror,a.onerror=function(b,c,d,f,g){',
    'h&&h(b,c,d,f,g),g||(g=new Error(b)),a[e].q=a[e].q||[],a[e].q.push({',
    'e:g})}}(window,document,"script","//cdn.raygun.io/raygun4js/' + js_api_version + 'raygun.min.js","rg4js");',
    '</script>'
  ].join('').html_safe
end

Private Instance Methods

js_api_key() click to toggle source
# File lib/raygun/javascript_tracker.rb, line 30
def js_api_key
  @js_api_key ||= Raygun.configuration.js_api_key
end
js_api_key?() click to toggle source
# File lib/raygun/javascript_tracker.rb, line 38
def js_api_key?
  js_api_key.present?
end
js_api_version() click to toggle source
# File lib/raygun/javascript_tracker.rb, line 34
def js_api_version
  @js_api_version ||= Raygun.configuration.js_api_version ? "#{Raygun.configuration.js_api_version}/" : ''
end