Traccia i movimenti aggregati, overlay a gradienti sull’iframe della pagina e toggle click/move in admin. Co-authored-by: Cursor <cursoragent@cursor.com>
15 lines
483 B
Ruby
15 lines
483 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AnalyticsEvent < ApplicationRecord
|
|
self.table_name = "analytics_events"
|
|
|
|
EVENT_TYPES = %w[click scroll pageview move].freeze
|
|
DEVICES = %w[mobile tablet desktop].freeze
|
|
|
|
validates :page_path, presence: true
|
|
validates :device, inclusion: { in: DEVICES }
|
|
validates :event_type, inclusion: { in: EVENT_TYPES }
|
|
validates :occurred_at, presence: true
|
|
validates :weight, numericality: { greater_than: 0, less_than_or_equal_to: 500 }
|
|
end
|