Method: Klaviyo::Metrics.get_metrics_timeline

Defined in:
lib/klaviyo/apis/metrics.rb

.get_metrics_timeline(since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC, api_key: nil) ⇒ Object

Returns a batched timeline of all events in your Klaviyo account.

Parameters:

  • since (Integer or String) (defaults to: nil)

    either a Unix timestamp or the UUID from a previous request. Default is the current time.

  • count (Integer) (defaults to: DEFAULT_COUNT)

    number of results to return, default 100

  • sort (String) (defaults to: DEFAULT_SORT_DESC)

    ‘asc’ or ‘desc’, sort order to apply to the timeline. Default is ‘desc’.

Returns:

  • a dictionary with a data property that contains an array of the metrics



24
25
26
27
28
29
30
31
32
# File 'lib/klaviyo/apis/metrics.rb', line 24

def self.get_metrics_timeline(since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC, api_key: nil)
  path = "#{METRICS}/#{TIMELINE}"
  params = {
    :since => since,
    :count => count,
    :sort => sort
  }
  v1_request(HTTP_GET, path, api_key: api_key, **params)
end