Module: Koderift::Rails::RumHelper
- Defined in:
- lib/koderift/rails/rum_helper.rb
Instance Method Summary collapse
-
#koderift_rum_meta_tag ⇒ Object
Renders the meta tag that rum.js reads for initialisation.
Instance Method Details
#koderift_rum_meta_tag ⇒ Object
Renders the meta tag that rum.js reads for initialisation. Place once inside
in your application layout.Example:
<%= koderift_rum_meta_tag %>
Renders:
<meta name="koderift-rum-token"
content="abc123"
data-rum-sampling-rate="0.1"
data-environment="production">
Returns an empty string when RUM is disabled or no token is configured.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/koderift/rails/rum_helper.rb', line 19 def config = Koderift::Rails.configuration return ''.html_safe unless config.rum_enabled && config.project_token.present? tag.( name: 'koderift-rum-token', content: config.project_token, data: { rum_sampling_rate: config.rum_sampling_rate.to_f, environment: (defined?(::Rails) && ::Rails.respond_to?(:env) ? ::Rails.env.to_s : 'production') } ) end |