Class: Sentiero::Analytics::ScrollDepthAnalyzer
- Defined in:
- lib/sentiero/analytics/scroll_depth_analyzer.rb
Overview
Aggregates per-URL scroll depth across sessions (avg depth, fold lines, distribution). Depth math lives in ScrollCollector; this drives it per URL.
Constant Summary collapse
- MAX_URLS =
200
Constants included from Events
Events::CUSTOM, Events::INCREMENTAL, Events::META, Events::SOURCE_INPUT, Events::SOURCE_MOUSE_INTERACTION, Events::SOURCE_SCROLL
Instance Attribute Summary
Attributes inherited from Analyzer
Instance Method Summary collapse
Methods inherited from Analyzer
Methods included from EntryAttribution
#earlier?, #first_meta_href, #same_origin?, #update_entry_candidate
Methods included from Bounded
#bounded_fetch, #bounded_increment
Methods included from Stats
#mean, #offset_ms, #percentile, #top_counts
Constructor Details
This class inherits a constructor from Sentiero::Analytics::Analyzer
Instance Method Details
#analyze(limit: nil, since: nil, until_time: nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sentiero/analytics/scroll_depth_analyzer.rb', line 13 def analyze(limit: nil, since: nil, until_time: nil) scroll = ScrollCollector.new(max_urls: MAX_URLS) _scanned, hit_cap = scan_sessions(limit: limit, since: since, until_time: until_time) do |_summary, _window_id, events| each_page_segment(events) do |url, segment, _anchor| scroll.observe(url, segment) if url end scroll.flush_window end { pages: scroll.pages, was_truncated: scroll.capped || hit_cap } end |