Class: GetStream::Generated::Models::TrackActivityMetricsEvent
- Inherits:
-
BaseModel
- Object
- BaseModel
- GetStream::Generated::Models::TrackActivityMetricsEvent
- Defined in:
- lib/getstream_ruby/generated/models/track_activity_metrics_event.rb
Overview
A single metric event to track for an activity
Instance Attribute Summary collapse
-
#activity_id ⇒ String
The ID of the activity to track the metric for.
-
#delta ⇒ Integer
The amount to increment (positive) or decrement (negative).
-
#dwell_ms ⇒ Integer
Milliseconds the activity was in view.
-
#metric ⇒ String
The metric name (e.g. views, clicks, impressions, dwell).
-
#position ⇒ Integer
1-based position of the activity in that feed read.
-
#request_id ⇒ String
The request_id returned by the feed read that showed the activity.
Class Method Summary collapse
-
.json_field_mappings ⇒ Object
Override field mappings for JSON serialization.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ TrackActivityMetricsEvent
constructor
Initialize with attributes.
Methods inherited from BaseModel
#==, #inspect, omit_empty_fields, #to_h, #to_json
Constructor Details
#initialize(attributes = {}) ⇒ TrackActivityMetricsEvent
Initialize with attributes
32 33 34 35 36 37 38 39 40 |
# File 'lib/getstream_ruby/generated/models/track_activity_metrics_event.rb', line 32 def initialize(attributes = {}) super(attributes) @activity_id = attributes.fetch(:activity_id) { attributes.fetch('activity_id', nil) } @metric = attributes.fetch(:metric) { attributes.fetch('metric', nil) } @delta = attributes.fetch(:delta) { attributes.fetch('delta', nil) } @dwell_ms = attributes.fetch(:dwell_ms) { attributes.fetch('dwell_ms', nil) } @position = attributes.fetch(:position) { attributes.fetch('position', nil) } @request_id = attributes.fetch(:request_id) { attributes.fetch('request_id', nil) } end |
Instance Attribute Details
#activity_id ⇒ String
Returns The ID of the activity to track the metric for.
14 15 16 |
# File 'lib/getstream_ruby/generated/models/track_activity_metrics_event.rb', line 14 def activity_id @activity_id end |
#delta ⇒ Integer
Returns The amount to increment (positive) or decrement (negative). Defaults to 1. The absolute value counts against rate limits.
20 21 22 |
# File 'lib/getstream_ruby/generated/models/track_activity_metrics_event.rb', line 20 def delta @delta end |
#dwell_ms ⇒ Integer
Returns Milliseconds the activity was in view. Required for the built-in dwell metric; apps with a custom dwell metric keep their own behavior.
23 24 25 |
# File 'lib/getstream_ruby/generated/models/track_activity_metrics_event.rb', line 23 def dwell_ms @dwell_ms end |
#metric ⇒ String
Returns The metric name (e.g. views, clicks, impressions, dwell). Alphanumeric and underscores only. dwell requires dwell_ms.
17 18 19 |
# File 'lib/getstream_ruby/generated/models/track_activity_metrics_event.rb', line 17 def metric @metric end |
#position ⇒ Integer
Returns 1-based position of the activity in that feed read. A value below 1 fails only this event. Accepted but not stored yet.
26 27 28 |
# File 'lib/getstream_ruby/generated/models/track_activity_metrics_event.rb', line 26 def position @position end |
#request_id ⇒ String
Returns The request_id returned by the feed read that showed the activity. An invalid, expired (older than 48h) or future-dated (more than 5 minutes ahead) value fails only this event. Impressions sent with a valid request_id must use a delta of 1 and feed For You engagement analytics. In apps that use feed impressions (exploration or impressions_bucket) they feed ranking and are not added to the activity's metrics.impressions; with For You analytics on and no feed impressions they are added as without a request_id.
29 30 31 |
# File 'lib/getstream_ruby/generated/models/track_activity_metrics_event.rb', line 29 def request_id @request_id end |
Class Method Details
.json_field_mappings ⇒ Object
Override field mappings for JSON serialization
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/getstream_ruby/generated/models/track_activity_metrics_event.rb', line 43 def self.json_field_mappings { activity_id: 'activity_id', metric: 'metric', delta: 'delta', dwell_ms: 'dwell_ms', position: 'position', request_id: 'request_id' } end |