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::KL_USER_AGENT, Client::KL_VERSION, 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, api_key: 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, api_key: nil) ⇒ Object
Returns a batched timeline for one specific type of metric.
-
.get_metrics(page: DEFAULT_PAGE, count: DEFAULT_COUNT, api_key: nil) ⇒ Object
Returns a list of all metrics in Klaviyo.
-
.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.
Class Method Details
.get_metric_export(metric_id, start_date: nil, end_date: nil, unit: nil, measurement: nil, where: nil, by: nil, count: nil, api_key: nil) ⇒ Object
Export event data, optionally filtering and segmented on available event properties
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/klaviyo/apis/metrics.rb', line 62 def self.get_metric_export(metric_id, start_date: nil, end_date: nil, unit: nil, measurement: nil, where: nil, by: nil, count: nil, api_key: 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, api_key: api_key, **params) end |
.get_metric_timeline(metric_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC, api_key: nil) ⇒ Object
Returns a batched timeline for one specific type of metric.
41 42 43 44 45 46 47 48 49 |
# File 'lib/klaviyo/apis/metrics.rb', line 41 def self.get_metric_timeline(metric_id, since: nil, count: DEFAULT_COUNT, sort: DEFAULT_SORT_DESC, api_key: nil) path = "#{METRIC}/#{metric_id}/#{TIMELINE}" params = { :since => since, :count => count, :sort => sort } v1_request(HTTP_GET, path, api_key: api_key, **params) end |
.get_metrics(page: DEFAULT_PAGE, count: DEFAULT_COUNT, api_key: nil) ⇒ Object
Returns a list of all metrics in Klaviyo
10 11 12 13 14 15 16 |
# File 'lib/klaviyo/apis/metrics.rb', line 10 def self.get_metrics(page: DEFAULT_PAGE, count: DEFAULT_COUNT, api_key: nil) params = { :page => page, :count => count } v1_request(HTTP_GET, METRICS, api_key: api_key, **params) end |
.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.
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 |