Class: GetStream::Generated::Models::TrackActivityMetricsEvent

Inherits:
BaseModel
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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.

Returns:

  • (String) —

    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.

Returns:

  • (Integer) —

    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.

Returns:

  • (Integer) —

    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.

Returns:

  • (String) —

    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.

Returns:

  • (Integer) —

    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.

Returns:

  • (String) —

    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