Class: Klaviyo::Metrics
Constant Summary collapse
- EXPORT =
'export'
Constants inherited from Client
Client::ALL, Client::BASE_API_URL, Client::CONTENT_JSON, Client::CONTENT_URL_FORM, Client::DEFAULT_COUNT, Client::DEFAULT_PAGE, Client::DEFAULT_SORT_DESC, Client::HTTP_DELETE, Client::HTTP_GET, Client::HTTP_POST, Client::HTTP_PUT, Client::METRIC, Client::METRICS, Client::TIMELINE, Client::V1_API, Client::V2_API
Class Method Summary collapse
-
.get_metric_export(metric_id, start_date: nil, end_date: nil, unit: nil, measurement: nil, where: nil, by: nil, count: nil) ⇒ Object
Export event data, optionally filtering and segmented on available event properties.
-
.get_metric_timeline(metric_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC) ⇒ Object
Returns a batched timeline for one specific type of metric.
-
.get_metrics(page: DEFAULT_PAGE, count: DEFAULT_COUNT) ⇒ Object
Returns a list of all metrics in Klaviyo.
-
.get_metrics_timeline(since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC) ⇒ Object
Returns a batched timeline of all events in your Klaviyo account.
Class Method Details
.get_metric_export(metric_id, start_date: nil, end_date: nil, unit: nil, measurement: nil, where: nil, by: nil, count: nil) ⇒ Object
Export event data, optionally filtering and segmented on available event properties
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/klaviyo/apis/metrics.rb', line 58 def self.get_metric_export(metric_id, start_date: nil, end_date: nil, unit: nil, measurement: nil, where: nil, by: nil, count: nil ) path = "#{METRIC}/#{metric_id}/#{EXPORT}" params = { :start_date => start_date, :end_date => end_date, :unit => unit, :measurement => measurement, :where => where, :by => by, :count => count } v1_request(HTTP_GET, path, params) end |
.get_metric_timeline(metric_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC) ⇒ Object
Returns a batched timeline for one specific type of metric.
38 39 40 41 42 43 44 45 46 |
# File 'lib/klaviyo/apis/metrics.rb', line 38 def self.get_metric_timeline(metric_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC) path = "#{METRIC}/#{metric_id}/#{TIMELINE}" params = { :since => since, :count => count, :sort => sort } v1_request(HTTP_GET, path, params) end |
.get_metrics(page: DEFAULT_PAGE, count: DEFAULT_COUNT) ⇒ Object
Returns a list of all metrics in Klaviyo
9 10 11 12 13 14 15 |
# File 'lib/klaviyo/apis/metrics.rb', line 9 def self.get_metrics(page: DEFAULT_PAGE, count: DEFAULT_COUNT) params = { :page => page, :count => count } v1_request(HTTP_GET, METRICS, params) end |
.get_metrics_timeline(since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC) ⇒ Object
Returns a batched timeline of all events in your Klaviyo account.
22 23 24 25 26 27 28 29 30 |
# File 'lib/klaviyo/apis/metrics.rb', line 22 def self.get_metrics_timeline(since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC) path = "#{METRICS}/#{TIMELINE}" params = { :since => since, :count => count, :sort => sort } v1_request(HTTP_GET, path, params) end |