Class: Late::AnalyticsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/late-sdk/api/analytics_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AnalyticsApi

Returns a new instance of AnalyticsApi.



19
20
21
# File 'lib/late-sdk/api/analytics_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/late-sdk/api/analytics_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_analytics(opts = {}) ⇒ GetAnalytics200Response

Get post analytics Returns analytics for posts. With postId, returns a single post. Without it, returns a paginated list with overview stats. Accepts both Zernio Post IDs and External Post IDs (auto-resolved). fromDate defaults to 90 days ago if omitted, max range 366 days. Single post lookups may return 202 (sync pending) or 424 (all platforms failed). For follower stats, use /v1/accounts/follower-stats.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :post_id (String)

    Returns analytics for a single post. Accepts both Zernio Post IDs and External Post IDs. Zernio IDs are auto-resolved to External Post analytics.

  • :platform (String)

    Filter by platform (default "all")

  • :profile_id (String)

    Filter by profile ID (default "all")

  • :account_id (String)

    Filter by social account ID

  • :source (String)

    Filter by post source: late (posted via Zernio API), external (synced from platform), all (default) (default to ‘all’)

  • :from_date (Date)

    Inclusive lower bound (YYYY-MM-DD). Defaults to 90 days ago if omitted. Max range is 366 days.

  • :to_date (Date)

    Inclusive upper bound (YYYY-MM-DD). Defaults to today if omitted.

  • :limit (Integer)

    Page size (default 50) (default to 50)

  • :page (Integer)

    Page number (default 1) (default to 1)

  • :sort_by (String)

    Sort by date, engagement, or a specific metric (default to ‘date’)

  • :order (String)

    Sort order (default to ‘desc’)

Returns:



37
38
39
40
# File 'lib/late-sdk/api/analytics_api.rb', line 37

def get_analytics(opts = {})
  data, _status_code, _headers = get_analytics_with_http_info(opts)
  data
end

#get_analytics_with_http_info(opts = {}) ⇒ Array<(GetAnalytics200Response, Integer, Hash)>

Get post analytics Returns analytics for posts. With postId, returns a single post. Without it, returns a paginated list with overview stats. Accepts both Zernio Post IDs and External Post IDs (auto-resolved). fromDate defaults to 90 days ago if omitted, max range 366 days. Single post lookups may return 202 (sync pending) or 424 (all platforms failed). For follower stats, use /v1/accounts/follower-stats.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :post_id (String)

    Returns analytics for a single post. Accepts both Zernio Post IDs and External Post IDs. Zernio IDs are auto-resolved to External Post analytics.

  • :platform (String)

    Filter by platform (default &quot;all&quot;)

  • :profile_id (String)

    Filter by profile ID (default &quot;all&quot;)

  • :account_id (String)

    Filter by social account ID

  • :source (String)

    Filter by post source: late (posted via Zernio API), external (synced from platform), all (default) (default to ‘all’)

  • :from_date (Date)

    Inclusive lower bound (YYYY-MM-DD). Defaults to 90 days ago if omitted. Max range is 366 days.

  • :to_date (Date)

    Inclusive upper bound (YYYY-MM-DD). Defaults to today if omitted.

  • :limit (Integer)

    Page size (default 50) (default to 50)

  • :page (Integer)

    Page number (default 1) (default to 1)

  • :sort_by (String)

    Sort by date, engagement, or a specific metric (default to ‘date’)

  • :order (String)

    Sort order (default to ‘desc’)

Returns:

  • (Array<(GetAnalytics200Response, Integer, Hash)>)

    GetAnalytics200Response data, response status code and response headers



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/late-sdk/api/analytics_api.rb', line 57

def get_analytics_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_analytics ...'
  end
  allowable_values = ["all", "late", "external"]
  if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source'])
    fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AnalyticsApi.get_analytics, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AnalyticsApi.get_analytics, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AnalyticsApi.get_analytics, must be greater than or equal to 1.'
  end

  allowable_values = ["date", "engagement", "impressions", "reach", "likes", "comments", "shares", "saves", "clicks", "views"]
  if @api_client.config.client_side_validation && opts[:'sort_by'] && !allowable_values.include?(opts[:'sort_by'])
    fail ArgumentError, "invalid value for \"sort_by\", must be one of #{allowable_values}"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
    fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/analytics'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'postId'] = opts[:'post_id'] if !opts[:'post_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetAnalytics200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_analytics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_best_time_to_post(opts = {}) ⇒ GetBestTimeToPost200Response

Get best times to post Returns the best times to post based on historical engagement data. Groups all published posts by day of week and hour (UTC), calculating average engagement per slot. Use this to auto-schedule posts at optimal times. Requires the Analytics add-on.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :platform (String)

    Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms.

  • :profile_id (String)

    Filter by profile ID. Omit for all profiles.

  • :source (String)

    Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. (default to ‘all’)

Returns:



143
144
145
146
# File 'lib/late-sdk/api/analytics_api.rb', line 143

def get_best_time_to_post(opts = {})
  data, _status_code, _headers = get_best_time_to_post_with_http_info(opts)
  data
end

#get_best_time_to_post_with_http_info(opts = {}) ⇒ Array<(GetBestTimeToPost200Response, Integer, Hash)>

Get best times to post Returns the best times to post based on historical engagement data. Groups all published posts by day of week and hour (UTC), calculating average engagement per slot. Use this to auto-schedule posts at optimal times. Requires the Analytics add-on.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :platform (String)

    Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms.

  • :profile_id (String)

    Filter by profile ID. Omit for all profiles.

  • :source (String)

    Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. (default to ‘all’)

Returns:



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/late-sdk/api/analytics_api.rb', line 155

def get_best_time_to_post_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_best_time_to_post ...'
  end
  allowable_values = ["all", "late", "external"]
  if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source'])
    fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/analytics/best-time'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetBestTimeToPost200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_best_time_to_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_best_time_to_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_content_decay(opts = {}) ⇒ GetContentDecay200Response

Get content performance decay Returns how engagement accumulates over time after a post is published. Each bucket shows what percentage of the post’s total engagement had been reached by that time window. Useful for understanding content lifespan (e.g. "posts reach 78% of total engagement within 24 hours"). Requires the Analytics add-on.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :platform (String)

    Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms.

  • :profile_id (String)

    Filter by profile ID. Omit for all profiles.

  • :source (String)

    Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. (default to ‘all’)

Returns:



213
214
215
216
# File 'lib/late-sdk/api/analytics_api.rb', line 213

def get_content_decay(opts = {})
  data, _status_code, _headers = get_content_decay_with_http_info(opts)
  data
end

#get_content_decay_with_http_info(opts = {}) ⇒ Array<(GetContentDecay200Response, Integer, Hash)>

Get content performance decay Returns how engagement accumulates over time after a post is published. Each bucket shows what percentage of the post&#39;s total engagement had been reached by that time window. Useful for understanding content lifespan (e.g. &quot;posts reach 78% of total engagement within 24 hours&quot;). Requires the Analytics add-on.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :platform (String)

    Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms.

  • :profile_id (String)

    Filter by profile ID. Omit for all profiles.

  • :source (String)

    Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. (default to ‘all’)

Returns:

  • (Array<(GetContentDecay200Response, Integer, Hash)>)

    GetContentDecay200Response data, response status code and response headers



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/late-sdk/api/analytics_api.rb', line 225

def get_content_decay_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_content_decay ...'
  end
  allowable_values = ["all", "late", "external"]
  if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source'])
    fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/analytics/content-decay'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetContentDecay200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_content_decay",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_content_decay\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_daily_metrics(opts = {}) ⇒ GetDailyMetrics200Response

Get daily aggregated metrics Returns daily aggregated analytics metrics and a per-platform breakdown. Each day includes post count, platform distribution, and summed metrics (impressions, reach, likes, comments, shares, saves, clicks, views). Defaults to the last 180 days. Requires the Analytics add-on.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :platform (String)

    Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms.

  • :profile_id (String)

    Filter by profile ID. Omit for all profiles.

  • :account_id (String)

    Filter by social account ID

  • :from_date (Time)

    Inclusive start date (ISO 8601). Defaults to 180 days ago.

  • :to_date (Time)

    Inclusive end date (ISO 8601). Defaults to now.

  • :source (String)

    Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. (default to ‘all’)

Returns:



286
287
288
289
# File 'lib/late-sdk/api/analytics_api.rb', line 286

def get_daily_metrics(opts = {})
  data, _status_code, _headers = get_daily_metrics_with_http_info(opts)
  data
end

#get_daily_metrics_with_http_info(opts = {}) ⇒ Array<(GetDailyMetrics200Response, Integer, Hash)>

Get daily aggregated metrics Returns daily aggregated analytics metrics and a per-platform breakdown. Each day includes post count, platform distribution, and summed metrics (impressions, reach, likes, comments, shares, saves, clicks, views). Defaults to the last 180 days. Requires the Analytics add-on.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :platform (String)

    Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms.

  • :profile_id (String)

    Filter by profile ID. Omit for all profiles.

  • :account_id (String)

    Filter by social account ID

  • :from_date (Time)

    Inclusive start date (ISO 8601). Defaults to 180 days ago.

  • :to_date (Time)

    Inclusive end date (ISO 8601). Defaults to now.

  • :source (String)

    Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. (default to ‘all’)

Returns:

  • (Array<(GetDailyMetrics200Response, Integer, Hash)>)

    GetDailyMetrics200Response data, response status code and response headers



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/late-sdk/api/analytics_api.rb', line 301

def get_daily_metrics_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_daily_metrics ...'
  end
  allowable_values = ["all", "late", "external"]
  if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source'])
    fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/analytics/daily-metrics'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetDailyMetrics200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_daily_metrics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_daily_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_follower_stats(opts = {}) ⇒ GetFollowerStats200Response

Get follower stats Returns follower count history and growth metrics for connected social accounts. Requires analytics add-on subscription. Follower counts are refreshed once per day.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :account_ids (String)

    Comma-separated list of account IDs (optional, defaults to all user&#39;s accounts)

  • :profile_id (String)

    Filter by profile ID

  • :from_date (Date)

    Start date in YYYY-MM-DD format (defaults to 30 days ago)

  • :to_date (Date)

    End date in YYYY-MM-DD format (defaults to today)

  • :granularity (String)

    Data aggregation level (default to ‘daily’)

Returns:



364
365
366
367
# File 'lib/late-sdk/api/analytics_api.rb', line 364

def get_follower_stats(opts = {})
  data, _status_code, _headers = get_follower_stats_with_http_info(opts)
  data
end

#get_follower_stats_with_http_info(opts = {}) ⇒ Array<(GetFollowerStats200Response, Integer, Hash)>

Get follower stats Returns follower count history and growth metrics for connected social accounts. Requires analytics add-on subscription. Follower counts are refreshed once per day.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :account_ids (String)

    Comma-separated list of account IDs (optional, defaults to all user&#39;s accounts)

  • :profile_id (String)

    Filter by profile ID

  • :from_date (Date)

    Start date in YYYY-MM-DD format (defaults to 30 days ago)

  • :to_date (Date)

    End date in YYYY-MM-DD format (defaults to today)

  • :granularity (String)

    Data aggregation level (default to ‘daily’)

Returns:

  • (Array<(GetFollowerStats200Response, Integer, Hash)>)

    GetFollowerStats200Response data, response status code and response headers



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/late-sdk/api/analytics_api.rb', line 378

def get_follower_stats_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_follower_stats ...'
  end
  allowable_values = ["daily", "weekly", "monthly"]
  if @api_client.config.client_side_validation && opts[:'granularity'] && !allowable_values.include?(opts[:'granularity'])
    fail ArgumentError, "invalid value for \"granularity\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/accounts/follower-stats'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountIds'] = opts[:'account_ids'] if !opts[:'account_ids'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'granularity'] = opts[:'granularity'] if !opts[:'granularity'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetFollowerStats200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_follower_stats",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_follower_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_google_business_performance(account_id, opts = {}) ⇒ GetGoogleBusinessPerformance200Response

Get Google Business Profile performance metrics Returns daily performance metrics for a Google Business Profile location. Metrics include impressions (Maps/Search, desktop/mobile), website clicks, call clicks, direction requests, conversations, bookings, and food orders. Data may be delayed 2-3 days. Max 18 months of historical data. Requires the Analytics add-on.

Parameters:

  • account_id (String)

    The Zernio SocialAccount ID for the Google Business Profile account.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :metrics (String)

    Comma-separated metric names. Defaults to all available metrics. Valid values: BUSINESS_IMPRESSIONS_DESKTOP_MAPS, BUSINESS_IMPRESSIONS_DESKTOP_SEARCH, BUSINESS_IMPRESSIONS_MOBILE_MAPS, BUSINESS_IMPRESSIONS_MOBILE_SEARCH, BUSINESS_CONVERSATIONS, BUSINESS_DIRECTION_REQUESTS, CALL_CLICKS, WEBSITE_CLICKS, BUSINESS_BOOKINGS, BUSINESS_FOOD_ORDERS, BUSINESS_FOOD_MENU_CLICKS

  • :start_date (Date)

    Start date (YYYY-MM-DD). Defaults to 30 days ago. Max 18 months back.

  • :end_date (Date)

    End date (YYYY-MM-DD). Defaults to today.

Returns:



439
440
441
442
# File 'lib/late-sdk/api/analytics_api.rb', line 439

def get_google_business_performance(, opts = {})
  data, _status_code, _headers = get_google_business_performance_with_http_info(, opts)
  data
end

#get_google_business_performance_with_http_info(account_id, opts = {}) ⇒ Array<(GetGoogleBusinessPerformance200Response, Integer, Hash)>

Get Google Business Profile performance metrics Returns daily performance metrics for a Google Business Profile location. Metrics include impressions (Maps/Search, desktop/mobile), website clicks, call clicks, direction requests, conversations, bookings, and food orders. Data may be delayed 2-3 days. Max 18 months of historical data. Requires the Analytics add-on.

Parameters:

  • account_id (String)

    The Zernio SocialAccount ID for the Google Business Profile account.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :metrics (String)

    Comma-separated metric names. Defaults to all available metrics. Valid values: BUSINESS_IMPRESSIONS_DESKTOP_MAPS, BUSINESS_IMPRESSIONS_DESKTOP_SEARCH, BUSINESS_IMPRESSIONS_MOBILE_MAPS, BUSINESS_IMPRESSIONS_MOBILE_SEARCH, BUSINESS_CONVERSATIONS, BUSINESS_DIRECTION_REQUESTS, CALL_CLICKS, WEBSITE_CLICKS, BUSINESS_BOOKINGS, BUSINESS_FOOD_ORDERS, BUSINESS_FOOD_MENU_CLICKS

  • :start_date (Date)

    Start date (YYYY-MM-DD). Defaults to 30 days ago. Max 18 months back.

  • :end_date (Date)

    End date (YYYY-MM-DD). Defaults to today.

Returns:



452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/late-sdk/api/analytics_api.rb', line 452

def get_google_business_performance_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_google_business_performance ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AnalyticsApi.get_google_business_performance"
  end
  # resource path
  local_var_path = '/v1/analytics/googlebusiness/performance'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'metrics'] = opts[:'metrics'] if !opts[:'metrics'].nil?
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetGoogleBusinessPerformance200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_google_business_performance",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_google_business_performance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_google_business_search_keywords(account_id, opts = {}) ⇒ GetGoogleBusinessSearchKeywords200Response

Get Google Business Profile search keywords Returns search keywords that triggered impressions for a Google Business Profile location. Data is aggregated monthly. Keywords below a minimum impression threshold set by Google are excluded. Max 18 months of historical data. Requires the Analytics add-on.

Parameters:

  • account_id (String)

    The Zernio SocialAccount ID for the Google Business Profile account.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_month (String)

    Start month (YYYY-MM). Defaults to 3 months ago.

  • :end_month (String)

    End month (YYYY-MM). Defaults to current month.

Returns:



511
512
513
514
# File 'lib/late-sdk/api/analytics_api.rb', line 511

def get_google_business_search_keywords(, opts = {})
  data, _status_code, _headers = get_google_business_search_keywords_with_http_info(, opts)
  data
end

#get_google_business_search_keywords_with_http_info(account_id, opts = {}) ⇒ Array<(GetGoogleBusinessSearchKeywords200Response, Integer, Hash)>

Get Google Business Profile search keywords Returns search keywords that triggered impressions for a Google Business Profile location. Data is aggregated monthly. Keywords below a minimum impression threshold set by Google are excluded. Max 18 months of historical data. Requires the Analytics add-on.

Parameters:

  • account_id (String)

    The Zernio SocialAccount ID for the Google Business Profile account.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_month (String)

    Start month (YYYY-MM). Defaults to 3 months ago.

  • :end_month (String)

    End month (YYYY-MM). Defaults to current month.

Returns:



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# File 'lib/late-sdk/api/analytics_api.rb', line 523

def get_google_business_search_keywords_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_google_business_search_keywords ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AnalyticsApi.get_google_business_search_keywords"
  end
  pattern = Regexp.new(/^\d{4}-\d{2}$/)
  if @api_client.config.client_side_validation && !opts[:'start_month'].nil? && opts[:'start_month'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"start_month\"]' when calling AnalyticsApi.get_google_business_search_keywords, must conform to the pattern #{pattern}."
  end

  pattern = Regexp.new(/^\d{4}-\d{2}$/)
  if @api_client.config.client_side_validation && !opts[:'end_month'].nil? && opts[:'end_month'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"end_month\"]' when calling AnalyticsApi.get_google_business_search_keywords, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/analytics/googlebusiness/search-keywords'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'startMonth'] = opts[:'start_month'] if !opts[:'start_month'].nil?
  query_params[:'endMonth'] = opts[:'end_month'] if !opts[:'end_month'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetGoogleBusinessSearchKeywords200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_google_business_search_keywords",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_google_business_search_keywords\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_instagram_account_insights(account_id, opts = {}) ⇒ InstagramAccountInsightsResponse

Get Instagram account-level insights Returns account-level Instagram insights such as reach, views, accounts engaged, and total interactions. These metrics reflect the entire account’s performance across all content surfaces (feed, stories, explore, profile), and are fundamentally different from post-level metrics. Data may be delayed up to 48 hours. Max 90 days, defaults to last 30 days. Requires the Analytics add-on.

Parameters:

  • account_id (String)

    The Zernio SocialAccount ID for the Instagram account

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :metrics (String)

    Comma-separated list of metrics. Defaults to &quot;reach,views,accounts_engaged,total_interactions&quot;. Valid metrics: reach, views, accounts_engaged, total_interactions, comments, likes, saves, shares, replies, reposts, follows_and_unfollows, profile_links_taps. Note: only &quot;reach&quot; supports metricType&#x3D;time_series. All other metrics are total_value only.

  • :since (Date)

    Start date (YYYY-MM-DD). Defaults to 30 days ago.

  • :_until (Date)

    End date (YYYY-MM-DD). Defaults to today.

  • :metric_type (String)

    &quot;total_value&quot; (default) returns aggregated totals and supports breakdowns. &quot;time_series&quot; returns daily values but only works with the &quot;reach&quot; metric. (default to ‘total_value’)

  • :breakdown (String)

    Breakdown dimension (only valid with metricType&#x3D;total_value). Valid values depend on the metric: media_product_type, follow_type, follower_type, contact_button_type.

Returns:



594
595
596
597
# File 'lib/late-sdk/api/analytics_api.rb', line 594

def (, opts = {})
  data, _status_code, _headers = (, opts)
  data
end

#get_instagram_account_insights_with_http_info(account_id, opts = {}) ⇒ Array<(InstagramAccountInsightsResponse, Integer, Hash)>

Get Instagram account-level insights Returns account-level Instagram insights such as reach, views, accounts engaged, and total interactions. These metrics reflect the entire account&#39;s performance across all content surfaces (feed, stories, explore, profile), and are fundamentally different from post-level metrics. Data may be delayed up to 48 hours. Max 90 days, defaults to last 30 days. Requires the Analytics add-on.

Parameters:

  • account_id (String)

    The Zernio SocialAccount ID for the Instagram account

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :metrics (String)

    Comma-separated list of metrics. Defaults to &quot;reach,views,accounts_engaged,total_interactions&quot;. Valid metrics: reach, views, accounts_engaged, total_interactions, comments, likes, saves, shares, replies, reposts, follows_and_unfollows, profile_links_taps. Note: only &quot;reach&quot; supports metricType&#x3D;time_series. All other metrics are total_value only.

  • :since (Date)

    Start date (YYYY-MM-DD). Defaults to 30 days ago.

  • :_until (Date)

    End date (YYYY-MM-DD). Defaults to today.

  • :metric_type (String)

    &quot;total_value&quot; (default) returns aggregated totals and supports breakdowns. &quot;time_series&quot; returns daily values but only works with the &quot;reach&quot; metric. (default to ‘total_value’)

  • :breakdown (String)

    Breakdown dimension (only valid with metricType&#x3D;total_value). Valid values depend on the metric: media_product_type, follow_type, follower_type, contact_button_type.

Returns:



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/late-sdk/api/analytics_api.rb', line 609

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_instagram_account_insights ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AnalyticsApi.get_instagram_account_insights"
  end
  allowable_values = ["time_series", "total_value"]
  if @api_client.config.client_side_validation && opts[:'metric_type'] && !allowable_values.include?(opts[:'metric_type'])
    fail ArgumentError, "invalid value for \"metric_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/analytics/instagram/account-insights'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'metrics'] = opts[:'metrics'] if !opts[:'metrics'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
  query_params[:'metricType'] = opts[:'metric_type'] if !opts[:'metric_type'].nil?
  query_params[:'breakdown'] = opts[:'breakdown'] if !opts[:'breakdown'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InstagramAccountInsightsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_instagram_account_insights",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_instagram_account_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_instagram_demographics(account_id, opts = {}) ⇒ InstagramDemographicsResponse

Get Instagram audience demographics Returns audience demographic insights for an Instagram account, broken down by age, city, country, and/or gender. Requires at least 100 followers. Returns top 45 entries per dimension. Data may be delayed up to 48 hours. Requires the Analytics add-on.

Parameters:

  • account_id (String)

    The Zernio SocialAccount ID for the Instagram account

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :metric (String)

    &quot;follower_demographics&quot; for follower audience data, or &quot;engaged_audience_demographics&quot; for engaged viewers. (default to ‘follower_demographics’)

  • :breakdown (String)

    Comma-separated list of demographic dimensions: age, city, country, gender. Defaults to all four if omitted.

  • :timeframe (String)

    Time period for demographic data. Defaults to &quot;this_month&quot;. (default to ‘this_month’)

Returns:



675
676
677
678
# File 'lib/late-sdk/api/analytics_api.rb', line 675

def get_instagram_demographics(, opts = {})
  data, _status_code, _headers = get_instagram_demographics_with_http_info(, opts)
  data
end

#get_instagram_demographics_with_http_info(account_id, opts = {}) ⇒ Array<(InstagramDemographicsResponse, Integer, Hash)>

Get Instagram audience demographics Returns audience demographic insights for an Instagram account, broken down by age, city, country, and/or gender. Requires at least 100 followers. Returns top 45 entries per dimension. Data may be delayed up to 48 hours. Requires the Analytics add-on.

Parameters:

  • account_id (String)

    The Zernio SocialAccount ID for the Instagram account

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :metric (String)

    &quot;follower_demographics&quot; for follower audience data, or &quot;engaged_audience_demographics&quot; for engaged viewers. (default to ‘follower_demographics’)

  • :breakdown (String)

    Comma-separated list of demographic dimensions: age, city, country, gender. Defaults to all four if omitted.

  • :timeframe (String)

    Time period for demographic data. Defaults to &quot;this_month&quot;. (default to ‘this_month’)

Returns:



688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
# File 'lib/late-sdk/api/analytics_api.rb', line 688

def get_instagram_demographics_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_instagram_demographics ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AnalyticsApi.get_instagram_demographics"
  end
  allowable_values = ["follower_demographics", "engaged_audience_demographics"]
  if @api_client.config.client_side_validation && opts[:'metric'] && !allowable_values.include?(opts[:'metric'])
    fail ArgumentError, "invalid value for \"metric\", must be one of #{allowable_values}"
  end
  allowable_values = ["this_week", "this_month"]
  if @api_client.config.client_side_validation && opts[:'timeframe'] && !allowable_values.include?(opts[:'timeframe'])
    fail ArgumentError, "invalid value for \"timeframe\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/analytics/instagram/demographics'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'metric'] = opts[:'metric'] if !opts[:'metric'].nil?
  query_params[:'breakdown'] = opts[:'breakdown'] if !opts[:'breakdown'].nil?
  query_params[:'timeframe'] = opts[:'timeframe'] if !opts[:'timeframe'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InstagramDemographicsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_instagram_demographics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_instagram_demographics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_linked_in_aggregate_analytics(account_id, opts = {}) ⇒ GetLinkedInAggregateAnalytics200Response

Get LinkedIn aggregate stats Returns aggregate analytics across all posts for a LinkedIn personal account. Org accounts should use /v1/analytics instead. Requires r_member_postAnalytics scope.

Parameters:

  • account_id (String)

    The ID of the LinkedIn personal account

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :aggregation (String)

    TOTAL (default, lifetime totals) or DAILY (time series). MEMBERS_REACHED not available with DAILY. (default to ‘TOTAL’)

  • :start_date (Date)

    Start date (YYYY-MM-DD). If omitted, returns lifetime analytics.

  • :end_date (Date)

    End date (YYYY-MM-DD, exclusive). Defaults to today if omitted.

  • :metrics (String)

    Comma-separated metrics: IMPRESSION, MEMBERS_REACHED, REACTION, COMMENT, RESHARE. Omit for all.

Returns:



757
758
759
760
# File 'lib/late-sdk/api/analytics_api.rb', line 757

def get_linked_in_aggregate_analytics(, opts = {})
  data, _status_code, _headers = get_linked_in_aggregate_analytics_with_http_info(, opts)
  data
end

#get_linked_in_aggregate_analytics_with_http_info(account_id, opts = {}) ⇒ Array<(GetLinkedInAggregateAnalytics200Response, Integer, Hash)>

Get LinkedIn aggregate stats Returns aggregate analytics across all posts for a LinkedIn personal account. Org accounts should use /v1/analytics instead. Requires r_member_postAnalytics scope.

Parameters:

  • account_id (String)

    The ID of the LinkedIn personal account

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :aggregation (String)

    TOTAL (default, lifetime totals) or DAILY (time series). MEMBERS_REACHED not available with DAILY. (default to ‘TOTAL’)

  • :start_date (Date)

    Start date (YYYY-MM-DD). If omitted, returns lifetime analytics.

  • :end_date (Date)

    End date (YYYY-MM-DD, exclusive). Defaults to today if omitted.

  • :metrics (String)

    Comma-separated metrics: IMPRESSION, MEMBERS_REACHED, REACTION, COMMENT, RESHARE. Omit for all.

Returns:



771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/late-sdk/api/analytics_api.rb', line 771

def get_linked_in_aggregate_analytics_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_linked_in_aggregate_analytics ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AnalyticsApi.get_linked_in_aggregate_analytics"
  end
  allowable_values = ["TOTAL", "DAILY"]
  if @api_client.config.client_side_validation && opts[:'aggregation'] && !allowable_values.include?(opts[:'aggregation'])
    fail ArgumentError, "invalid value for \"aggregation\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/linkedin-aggregate-analytics'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'aggregation'] = opts[:'aggregation'] if !opts[:'aggregation'].nil?
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'metrics'] = opts[:'metrics'] if !opts[:'metrics'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetLinkedInAggregateAnalytics200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_linked_in_aggregate_analytics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_linked_in_aggregate_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_linked_in_post_analytics(account_id, urn, opts = {}) ⇒ GetLinkedInPostAnalytics200Response

Get LinkedIn post stats Returns analytics for a specific LinkedIn post by URN. Works for both personal and organization accounts.

Parameters:

  • account_id (String)

    The ID of the LinkedIn account

  • urn (String)

    The LinkedIn post URN

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



833
834
835
836
# File 'lib/late-sdk/api/analytics_api.rb', line 833

def get_linked_in_post_analytics(, urn, opts = {})
  data, _status_code, _headers = get_linked_in_post_analytics_with_http_info(, urn, opts)
  data
end

#get_linked_in_post_analytics_with_http_info(account_id, urn, opts = {}) ⇒ Array<(GetLinkedInPostAnalytics200Response, Integer, Hash)>

Get LinkedIn post stats Returns analytics for a specific LinkedIn post by URN. Works for both personal and organization accounts.

Parameters:

  • account_id (String)

    The ID of the LinkedIn account

  • urn (String)

    The LinkedIn post URN

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
# File 'lib/late-sdk/api/analytics_api.rb', line 844

def get_linked_in_post_analytics_with_http_info(, urn, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_linked_in_post_analytics ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AnalyticsApi.get_linked_in_post_analytics"
  end
  # verify the required parameter 'urn' is set
  if @api_client.config.client_side_validation && urn.nil?
    fail ArgumentError, "Missing the required parameter 'urn' when calling AnalyticsApi.get_linked_in_post_analytics"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/linkedin-post-analytics'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'urn'] = urn

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetLinkedInPostAnalytics200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_linked_in_post_analytics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_linked_in_post_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_linked_in_post_reactions(account_id, urn, opts = {}) ⇒ GetLinkedInPostReactions200Response

Get LinkedIn post reactions Returns individual reactions for a specific LinkedIn post, including reactor profiles (name, headline/job title, profile picture, profile URL, reaction type). Only works for **organization/company page** accounts. LinkedIn restricts reaction data for personal profiles (r_member_social_feed is a closed permission).

Parameters:

  • account_id (String)

    The ID of the LinkedIn organization account

  • urn (String)

    The LinkedIn post URN

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Maximum number of reactions to return per page (default to 25)

  • :cursor (String)

    Offset-based pagination start index

Returns:



905
906
907
908
# File 'lib/late-sdk/api/analytics_api.rb', line 905

def get_linked_in_post_reactions(, urn, opts = {})
  data, _status_code, _headers = get_linked_in_post_reactions_with_http_info(, urn, opts)
  data
end

#get_linked_in_post_reactions_with_http_info(account_id, urn, opts = {}) ⇒ Array<(GetLinkedInPostReactions200Response, Integer, Hash)>

Get LinkedIn post reactions Returns individual reactions for a specific LinkedIn post, including reactor profiles (name, headline/job title, profile picture, profile URL, reaction type). Only works for **organization/company page** accounts. LinkedIn restricts reaction data for personal profiles (r_member_social_feed is a closed permission).

Parameters:

  • account_id (String)

    The ID of the LinkedIn organization account

  • urn (String)

    The LinkedIn post URN

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Maximum number of reactions to return per page (default to 25)

  • :cursor (String)

    Offset-based pagination start index

Returns:



918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
# File 'lib/late-sdk/api/analytics_api.rb', line 918

def get_linked_in_post_reactions_with_http_info(, urn, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_linked_in_post_reactions ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AnalyticsApi.get_linked_in_post_reactions"
  end
  # verify the required parameter 'urn' is set
  if @api_client.config.client_side_validation && urn.nil?
    fail ArgumentError, "Missing the required parameter 'urn' when calling AnalyticsApi.get_linked_in_post_reactions"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AnalyticsApi.get_linked_in_post_reactions, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AnalyticsApi.get_linked_in_post_reactions, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/accounts/{accountId}/linkedin-post-reactions'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'urn'] = urn
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetLinkedInPostReactions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_linked_in_post_reactions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_linked_in_post_reactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_post_timeline(post_id, opts = {}) ⇒ GetPostTimeline200Response

Get post analytics timeline Returns a daily timeline of analytics metrics for a specific post, showing how impressions, likes, and other metrics evolved day-by-day since publishing. Each row represents one day of data per platform. For multi-platform Zernio posts, returns separate rows for each platform. Requires the Analytics add-on.

Parameters:

  • post_id (String)

    The post to fetch timeline for. Accepts an ExternalPost ID, a platformPostId, or a Zernio Post ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from_date (Time)

    Start of date range (ISO 8601). Defaults to 90 days ago.

  • :to_date (Time)

    End of date range (ISO 8601). Defaults to now.

Returns:



988
989
990
991
# File 'lib/late-sdk/api/analytics_api.rb', line 988

def get_post_timeline(post_id, opts = {})
  data, _status_code, _headers = get_post_timeline_with_http_info(post_id, opts)
  data
end

#get_post_timeline_with_http_info(post_id, opts = {}) ⇒ Array<(GetPostTimeline200Response, Integer, Hash)>

Get post analytics timeline Returns a daily timeline of analytics metrics for a specific post, showing how impressions, likes, and other metrics evolved day-by-day since publishing. Each row represents one day of data per platform. For multi-platform Zernio posts, returns separate rows for each platform. Requires the Analytics add-on.

Parameters:

  • post_id (String)

    The post to fetch timeline for. Accepts an ExternalPost ID, a platformPostId, or a Zernio Post ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from_date (Time)

    Start of date range (ISO 8601). Defaults to 90 days ago.

  • :to_date (Time)

    End of date range (ISO 8601). Defaults to now.

Returns:

  • (Array<(GetPostTimeline200Response, Integer, Hash)>)

    GetPostTimeline200Response data, response status code and response headers



1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
# File 'lib/late-sdk/api/analytics_api.rb', line 1000

def get_post_timeline_with_http_info(post_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_post_timeline ...'
  end
  # verify the required parameter 'post_id' is set
  if @api_client.config.client_side_validation && post_id.nil?
    fail ArgumentError, "Missing the required parameter 'post_id' when calling AnalyticsApi.get_post_timeline"
  end
  # resource path
  local_var_path = '/v1/analytics/post-timeline'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'postId'] = post_id
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetPostTimeline200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_post_timeline",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_post_timeline\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_posting_frequency(opts = {}) ⇒ GetPostingFrequency200Response

Get posting frequency vs engagement Returns the correlation between posting frequency (posts per week) and engagement rate, broken down by platform. Helps find the optimal posting cadence for each platform. Each row represents a specific (platform, posts_per_week) combination with the average engagement rate observed across all weeks matching that frequency. Requires the Analytics add-on.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :platform (String)

    Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms.

  • :profile_id (String)

    Filter by profile ID. Omit for all profiles.

  • :source (String)

    Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. (default to ‘all’)

Returns:



1058
1059
1060
1061
# File 'lib/late-sdk/api/analytics_api.rb', line 1058

def get_posting_frequency(opts = {})
  data, _status_code, _headers = get_posting_frequency_with_http_info(opts)
  data
end

#get_posting_frequency_with_http_info(opts = {}) ⇒ Array<(GetPostingFrequency200Response, Integer, Hash)>

Get posting frequency vs engagement Returns the correlation between posting frequency (posts per week) and engagement rate, broken down by platform. Helps find the optimal posting cadence for each platform. Each row represents a specific (platform, posts_per_week) combination with the average engagement rate observed across all weeks matching that frequency. Requires the Analytics add-on.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :platform (String)

    Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms.

  • :profile_id (String)

    Filter by profile ID. Omit for all profiles.

  • :source (String)

    Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. (default to ‘all’)

Returns:



1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
# File 'lib/late-sdk/api/analytics_api.rb', line 1070

def get_posting_frequency_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_posting_frequency ...'
  end
  allowable_values = ["all", "late", "external"]
  if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source'])
    fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/analytics/posting-frequency'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetPostingFrequency200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_posting_frequency",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_posting_frequency\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_you_tube_daily_views(video_id, account_id, opts = {}) ⇒ YouTubeDailyViewsResponse

Get YouTube daily views Returns daily view counts for a YouTube video including views, watch time, and subscriber changes. Requires yt-analytics.readonly scope (re-authorization may be needed). Data has a 2-3 day delay. Max 90 days, defaults to last 30 days.

Parameters:

  • video_id (String)

    The YouTube video ID (e.g., &quot;dQw4w9WgXcQ&quot;)

  • account_id (String)

    The Zernio account ID for the YouTube account

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (Date)

    Start date (YYYY-MM-DD). Defaults to 30 days ago.

  • :end_date (Date)

    End date (YYYY-MM-DD). Defaults to 3 days ago (YouTube data latency).

Returns:



1129
1130
1131
1132
# File 'lib/late-sdk/api/analytics_api.rb', line 1129

def get_you_tube_daily_views(video_id, , opts = {})
  data, _status_code, _headers = get_you_tube_daily_views_with_http_info(video_id, , opts)
  data
end

#get_you_tube_daily_views_with_http_info(video_id, account_id, opts = {}) ⇒ Array<(YouTubeDailyViewsResponse, Integer, Hash)>

Get YouTube daily views Returns daily view counts for a YouTube video including views, watch time, and subscriber changes. Requires yt-analytics.readonly scope (re-authorization may be needed). Data has a 2-3 day delay. Max 90 days, defaults to last 30 days.

Parameters:

  • video_id (String)

    The YouTube video ID (e.g., &quot;dQw4w9WgXcQ&quot;)

  • account_id (String)

    The Zernio account ID for the YouTube account

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (Date)

    Start date (YYYY-MM-DD). Defaults to 30 days ago.

  • :end_date (Date)

    End date (YYYY-MM-DD). Defaults to 3 days ago (YouTube data latency).

Returns:

  • (Array<(YouTubeDailyViewsResponse, Integer, Hash)>)

    YouTubeDailyViewsResponse data, response status code and response headers



1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
# File 'lib/late-sdk/api/analytics_api.rb', line 1142

def get_you_tube_daily_views_with_http_info(video_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_you_tube_daily_views ...'
  end
  # verify the required parameter 'video_id' is set
  if @api_client.config.client_side_validation && video_id.nil?
    fail ArgumentError, "Missing the required parameter 'video_id' when calling AnalyticsApi.get_you_tube_daily_views"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AnalyticsApi.get_you_tube_daily_views"
  end
  # resource path
  local_var_path = '/v1/analytics/youtube/daily-views'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'videoId'] = video_id
  query_params[:'accountId'] = 
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'YouTubeDailyViewsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_you_tube_daily_views",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_you_tube_daily_views\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_you_tube_demographics(account_id, opts = {}) ⇒ YouTubeDemographicsResponse

Get YouTube audience demographics Returns audience demographic insights for a YouTube channel, broken down by age, gender, and/or country. Age and gender values are viewer percentages (0-100). Country values are view counts. Data is based on signed-in viewers only, with a 2-3 day delay. Requires the Analytics add-on.

Parameters:

  • account_id (String)

    The Zernio SocialAccount ID for the YouTube account

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :breakdown (String)

    Comma-separated list of demographic dimensions: age, gender, country. Defaults to all three if omitted.

  • :start_date (Date)

    Start date in YYYY-MM-DD format. Defaults to 90 days ago.

  • :end_date (Date)

    End date in YYYY-MM-DD format. Defaults to 3 days ago (YouTube data latency).

Returns:



1206
1207
1208
1209
# File 'lib/late-sdk/api/analytics_api.rb', line 1206

def get_you_tube_demographics(, opts = {})
  data, _status_code, _headers = get_you_tube_demographics_with_http_info(, opts)
  data
end

#get_you_tube_demographics_with_http_info(account_id, opts = {}) ⇒ Array<(YouTubeDemographicsResponse, Integer, Hash)>

Get YouTube audience demographics Returns audience demographic insights for a YouTube channel, broken down by age, gender, and/or country. Age and gender values are viewer percentages (0-100). Country values are view counts. Data is based on signed-in viewers only, with a 2-3 day delay. Requires the Analytics add-on.

Parameters:

  • account_id (String)

    The Zernio SocialAccount ID for the YouTube account

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :breakdown (String)

    Comma-separated list of demographic dimensions: age, gender, country. Defaults to all three if omitted.

  • :start_date (Date)

    Start date in YYYY-MM-DD format. Defaults to 90 days ago.

  • :end_date (Date)

    End date in YYYY-MM-DD format. Defaults to 3 days ago (YouTube data latency).

Returns:

  • (Array<(YouTubeDemographicsResponse, Integer, Hash)>)

    YouTubeDemographicsResponse data, response status code and response headers



1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
# File 'lib/late-sdk/api/analytics_api.rb', line 1219

def get_you_tube_demographics_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_you_tube_demographics ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AnalyticsApi.get_you_tube_demographics"
  end
  # resource path
  local_var_path = '/v1/analytics/youtube/demographics'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'breakdown'] = opts[:'breakdown'] if !opts[:'breakdown'].nil?
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'YouTubeDemographicsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AnalyticsApi.get_you_tube_demographics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AnalyticsApi#get_you_tube_demographics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end