Module: Gricer::TrackHelper

Defined in:
lib/gricer/action_controller/track.rb

Overview

Helper Method to include Javascript code to capture extra values like screen size

Instance Method Summary collapse

Instance Method Details

#gricer_track_tagObject

Include Gricer’s Javascript code to track values like screen size.

You should include this at the end of your layout file. For pages matching the Gricer::Config.exclude_paths expression, nothing will be added to your page.

Examples:

For html.erb add at the end of your layout file:

<html>
  <head>[...]</head>
  <body>
     [...]
     <%= gricer_track_tag %>
   </body>
 </html>

For html.haml add at the end of your layout file:

%html
  %head
    [...]
  %body
    [...]
    = gricer_track_tag 


84
85
86
87
88
# File 'lib/gricer/action_controller/track.rb', line 84

def gricer_track_tag
  if gricer_request and defined?(gricer_capture_path)
     :script, "jQuery(function($) {$.post('#{gricer_capture_path(gricer_request.id)}', Gricer.prepareValues());});", type: 'text/javascript'
  end
end