Skip to content

Latest commit

 

History

History
1671 lines (1227 loc) · 73.6 KB

File metadata and controls

1671 lines (1227 loc) · 73.6 KB

Zernio::AnalyticsApi

All URIs are relative to https://zernio.com/api

Method HTTP request Description
get_analytics GET /v1/analytics Get post analytics
get_best_time_to_post GET /v1/analytics/best-time Get best times to post
get_content_decay GET /v1/analytics/content-decay Get content performance decay
get_daily_metrics GET /v1/analytics/daily-metrics Get daily aggregated metrics
get_facebook_page_insights GET /v1/analytics/facebook/page-insights Get Facebook Page insights
get_follower_stats GET /v1/accounts/follower-stats Get follower stats
get_google_business_performance GET /v1/analytics/googlebusiness/performance Get GBP performance metrics
get_google_business_search_keywords GET /v1/analytics/googlebusiness/search-keywords Get GBP search keywords
get_instagram_account_insights GET /v1/analytics/instagram/account-insights Get Instagram insights
get_instagram_demographics GET /v1/analytics/instagram/demographics Get Instagram demographics
get_instagram_follower_history GET /v1/analytics/instagram/follower-history Get Instagram follower history
get_linked_in_aggregate_analytics GET /v1/accounts/{accountId}/linkedin-aggregate-analytics Get LinkedIn aggregate stats
get_linked_in_org_aggregate_analytics GET /v1/analytics/linkedin/org-aggregate-analytics Get LinkedIn organization page aggregate analytics
get_linked_in_post_analytics GET /v1/accounts/{accountId}/linkedin-post-analytics Get LinkedIn post stats
get_linked_in_post_reactions GET /v1/accounts/{accountId}/linkedin-post-reactions Get LinkedIn post reactions
get_post_timeline GET /v1/analytics/post-timeline Get post analytics timeline
get_posting_frequency GET /v1/analytics/posting-frequency Get frequency vs engagement
get_tik_tok_account_insights GET /v1/analytics/tiktok/account-insights Get TikTok account-level insights
get_you_tube_channel_insights GET /v1/analytics/youtube/channel-insights Get YouTube channel-level insights
get_you_tube_daily_views GET /v1/analytics/youtube/daily-views Get YouTube daily views
get_you_tube_demographics GET /v1/analytics/youtube/demographics Get YouTube demographics

get_analytics

get_analytics(opts)

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. LinkedIn personal accounts: Analytics are only available for posts published through Zernio. LinkedIn's API only returns metrics for posts authored by the authenticated user. Organization/company page analytics work for all posts.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
opts = {
  post_id: 'post_id_example', # 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: 'platform_example', # String | Filter by platform (default \"all\")
  profile_id: 'profile_id_example', # String | Filter by profile ID (default \"all\")
  account_id: 'account_id_example', # String | Filter by social account ID
  source: 'all', # String | Filter by post source: late (posted via Zernio API), external (synced from platform), all (default)
  from_date: Date.parse('2013-10-20'), # Date | Inclusive lower bound (YYYY-MM-DD). Defaults to 90 days ago if omitted. Max range is 366 days.
  to_date: Date.parse('2013-10-20'), # Date | Inclusive upper bound (YYYY-MM-DD). Defaults to today if omitted.
  limit: 56, # Integer | Page size (default 50)
  page: 56, # Integer | Page number (default 1)
  sort_by: 'date', # String | Sort by date, engagement, or a specific metric
  order: 'asc' # String | Sort order
}

begin
  # Get post analytics
  result = api_instance.get_analytics(opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_analytics: #{e}"
end

Using the get_analytics_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_analytics_with_http_info(opts)

begin
  # Get post analytics
  data, status_code, headers = api_instance.get_analytics_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetAnalytics200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_analytics_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
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. [optional]
platform String Filter by platform (default &quot;all&quot;) [optional]
profile_id String Filter by profile ID (default &quot;all&quot;) [optional]
account_id String Filter by social account ID [optional]
source String Filter by post source: late (posted via Zernio API), external (synced from platform), all (default) [optional][default to 'all']
from_date Date Inclusive lower bound (YYYY-MM-DD). Defaults to 90 days ago if omitted. Max range is 366 days. [optional]
to_date Date Inclusive upper bound (YYYY-MM-DD). Defaults to today if omitted. [optional]
limit Integer Page size (default 50) [optional][default to 50]
page Integer Page number (default 1) [optional][default to 1]
sort_by String Sort by date, engagement, or a specific metric [optional][default to 'date']
order String Sort order [optional][default to 'desc']

Return type

GetAnalytics200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_best_time_to_post

get_best_time_to_post(opts)

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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
opts = {
  platform: 'platform_example', # String | Filter by platform (e.g. \"instagram\", \"tiktok\"). Omit for all platforms.
  profile_id: 'profile_id_example', # String | Filter by profile ID. Omit for all profiles.
  account_id: 'account_id_example', # String | Filter by social account ID. Omit for all accounts.
  source: 'all' # String | Filter by post origin. \"late\" for posts published via Zernio, \"external\" for posts imported from platforms.
}

begin
  # Get best times to post
  result = api_instance.get_best_time_to_post(opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_best_time_to_post: #{e}"
end

Using the get_best_time_to_post_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_best_time_to_post_with_http_info(opts)

begin
  # Get best times to post
  data, status_code, headers = api_instance.get_best_time_to_post_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetBestTimeToPost200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_best_time_to_post_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
platform String Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms. [optional]
profile_id String Filter by profile ID. Omit for all profiles. [optional]
account_id String Filter by social account ID. Omit for all accounts. [optional]
source String Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. [optional][default to 'all']

Return type

GetBestTimeToPost200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_content_decay

get_content_decay(opts)

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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
opts = {
  platform: 'platform_example', # String | Filter by platform (e.g. \"instagram\", \"tiktok\"). Omit for all platforms.
  profile_id: 'profile_id_example', # String | Filter by profile ID. Omit for all profiles.
  account_id: 'account_id_example', # String | Filter by social account ID. Omit for all accounts.
  source: 'all' # String | Filter by post origin. \"late\" for posts published via Zernio, \"external\" for posts imported from platforms.
}

begin
  # Get content performance decay
  result = api_instance.get_content_decay(opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_content_decay: #{e}"
end

Using the get_content_decay_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_content_decay_with_http_info(opts)

begin
  # Get content performance decay
  data, status_code, headers = api_instance.get_content_decay_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetContentDecay200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_content_decay_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
platform String Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms. [optional]
profile_id String Filter by profile ID. Omit for all profiles. [optional]
account_id String Filter by social account ID. Omit for all accounts. [optional]
source String Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. [optional][default to 'all']

Return type

GetContentDecay200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_daily_metrics

get_daily_metrics(opts)

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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
opts = {
  platform: 'platform_example', # String | Filter by platform (e.g. \"instagram\", \"tiktok\"). Omit for all platforms.
  profile_id: 'profile_id_example', # String | Filter by profile ID. Omit for all profiles.
  account_id: 'account_id_example', # String | Filter by social account ID
  from_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Inclusive start date (ISO 8601). Defaults to 180 days ago.
  to_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Inclusive end date (ISO 8601). Defaults to now.
  source: 'all' # String | Filter by post origin. \"late\" for posts published via Zernio, \"external\" for posts imported from platforms.
}

begin
  # Get daily aggregated metrics
  result = api_instance.get_daily_metrics(opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_daily_metrics: #{e}"
end

Using the get_daily_metrics_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_daily_metrics_with_http_info(opts)

begin
  # Get daily aggregated metrics
  data, status_code, headers = api_instance.get_daily_metrics_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetDailyMetrics200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_daily_metrics_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
platform String Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms. [optional]
profile_id String Filter by profile ID. Omit for all profiles. [optional]
account_id String Filter by social account ID [optional]
from_date Time Inclusive start date (ISO 8601). Defaults to 180 days ago. [optional]
to_date Time Inclusive end date (ISO 8601). Defaults to now. [optional]
source String Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. [optional][default to 'all']

Return type

GetDailyMetrics200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_facebook_page_insights

get_facebook_page_insights(account_id, opts)

Get Facebook Page insights

Returns page-level Facebook insights (media views, views, post engagements, video metrics, follower counts). Response shape matches /v1/analytics/instagram/account-insights so the same client handling works across platforms. Metric names track the current (post-November 2025) Meta Graph API. The legacy page_impressions / page_fans / page_fan_adds / page_fan_removes metrics were deprecated by Meta on November 15, 2025 and are NOT accepted by this endpoint. Use the replacements below. Because Meta did not provide direct adds/removes replacements, Zernio synthesizes followers_gained / followers_lost from the daily follower snapshotter. Max 89 days, defaults to last 30 days. Requires the Analytics add-on.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the connected Facebook Page.
opts = {
  metrics: 'metrics_example', # String | Comma-separated list of metrics. Defaults to \"page_media_view,page_post_engagements,page_follows,followers_gained,followers_lost\".  Live Meta metrics (current names, post-Nov-2025):   - page_media_view       (replaces deprecated page_impressions)   - page_views_total   - page_post_engagements   - page_video_views   - page_video_view_time   - page_follows          (replaces deprecated page_fans)  Zernio-synthesized from daily follower snapshots (filling the Nov-2025 gap left by the page_fan_adds / page_fan_removes deprecation):   - followers_gained   - followers_lost 
  since: Date.parse('2013-10-20'), # Date | Start date (YYYY-MM-DD). Defaults to 30 days ago.
  _until: Date.parse('2013-10-20'), # Date | End date (YYYY-MM-DD). Defaults to today.
  metric_type: 'time_series' # String | \"total_value\" (default) returns aggregated totals only. \"time_series\" returns daily values in the \"values\" array. 
}

begin
  # Get Facebook Page insights
  result = api_instance.get_facebook_page_insights(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_facebook_page_insights: #{e}"
end

Using the get_facebook_page_insights_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_facebook_page_insights_with_http_info(account_id, opts)

begin
  # Get Facebook Page insights
  data, status_code, headers = api_instance.get_facebook_page_insights_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <InstagramAccountInsightsResponse>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_facebook_page_insights_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The Zernio SocialAccount ID for the connected Facebook Page.
metrics String Comma-separated list of metrics. Defaults to &quot;page_media_view,page_post_engagements,page_follows,followers_gained,followers_lost&quot;. Live Meta metrics (current names, post-Nov-2025): - page_media_view (replaces deprecated page_impressions) - page_views_total - page_post_engagements - page_video_views - page_video_view_time - page_follows (replaces deprecated page_fans) Zernio-synthesized from daily follower snapshots (filling the Nov-2025 gap left by the page_fan_adds / page_fan_removes deprecation): - followers_gained - followers_lost [optional]
since Date Start date (YYYY-MM-DD). Defaults to 30 days ago. [optional]
_until Date End date (YYYY-MM-DD). Defaults to today. [optional]
metric_type String &quot;total_value&quot; (default) returns aggregated totals only. &quot;time_series&quot; returns daily values in the &quot;values&quot; array. [optional][default to 'total_value']

Return type

InstagramAccountInsightsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_follower_stats

get_follower_stats(opts)

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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
opts = {
  account_ids: 'account_ids_example', # String | Comma-separated list of account IDs (optional, defaults to all user's accounts)
  profile_id: 'profile_id_example', # String | Filter by profile ID
  from_date: Date.parse('2013-10-20'), # Date | Start date in YYYY-MM-DD format (defaults to 30 days ago)
  to_date: Date.parse('2013-10-20'), # Date | End date in YYYY-MM-DD format (defaults to today)
  granularity: 'daily' # String | Data aggregation level
}

begin
  # Get follower stats
  result = api_instance.get_follower_stats(opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_follower_stats: #{e}"
end

Using the get_follower_stats_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_follower_stats_with_http_info(opts)

begin
  # Get follower stats
  data, status_code, headers = api_instance.get_follower_stats_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetFollowerStats200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_follower_stats_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_ids String Comma-separated list of account IDs (optional, defaults to all user's accounts) [optional]
profile_id String Filter by profile ID [optional]
from_date Date Start date in YYYY-MM-DD format (defaults to 30 days ago) [optional]
to_date Date End date in YYYY-MM-DD format (defaults to today) [optional]
granularity String Data aggregation level [optional][default to 'daily']

Return type

GetFollowerStats200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_google_business_performance

get_google_business_performance(account_id, opts)

Get GBP 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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the Google Business Profile account.
opts = {
  metrics: 'metrics_example', # 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.parse('2013-10-20'), # Date | Start date (YYYY-MM-DD). Defaults to 30 days ago. Max 18 months back.
  end_date: Date.parse('2013-10-20') # Date | End date (YYYY-MM-DD). Defaults to today.
}

begin
  # Get GBP performance metrics
  result = api_instance.get_google_business_performance(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_google_business_performance: #{e}"
end

Using the get_google_business_performance_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_google_business_performance_with_http_info(account_id, opts)

begin
  # Get GBP performance metrics
  data, status_code, headers = api_instance.get_google_business_performance_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetGoogleBusinessPerformance200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_google_business_performance_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The Zernio SocialAccount ID for the Google Business Profile account.
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 [optional]
start_date Date Start date (YYYY-MM-DD). Defaults to 30 days ago. Max 18 months back. [optional]
end_date Date End date (YYYY-MM-DD). Defaults to today. [optional]

Return type

GetGoogleBusinessPerformance200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_google_business_search_keywords

get_google_business_search_keywords(account_id, opts)

Get GBP 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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the Google Business Profile account.
opts = {
  start_month: 'start_month_example', # String | Start month (YYYY-MM). Defaults to 3 months ago.
  end_month: 'end_month_example' # String | End month (YYYY-MM). Defaults to current month.
}

begin
  # Get GBP search keywords
  result = api_instance.get_google_business_search_keywords(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_google_business_search_keywords: #{e}"
end

Using the get_google_business_search_keywords_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_google_business_search_keywords_with_http_info(account_id, opts)

begin
  # Get GBP search keywords
  data, status_code, headers = api_instance.get_google_business_search_keywords_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetGoogleBusinessSearchKeywords200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_google_business_search_keywords_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The Zernio SocialAccount ID for the Google Business Profile account.
start_month String Start month (YYYY-MM). Defaults to 3 months ago. [optional]
end_month String End month (YYYY-MM). Defaults to current month. [optional]

Return type

GetGoogleBusinessSearchKeywords200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_instagram_account_insights

get_instagram_account_insights(account_id, opts)

Get Instagram 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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the Instagram account
opts = {
  metrics: 'metrics_example', # String | Comma-separated list of metrics. Defaults to \"reach,views,accounts_engaged,total_interactions\". Valid metrics: reach, views, accounts_engaged, total_interactions, comments, likes, saves, shares, replies, reposts, follows_and_unfollows, profile_links_taps. Note: only \"reach\" supports metricType=time_series. All other metrics (including follows_and_unfollows) are total_value only. This is an Instagram Graph API limitation, not a Zernio limitation - the IG API does not return time-series data for these metrics. For a daily running follower count, use /v1/analytics/instagram/follower-history instead. 
  since: Date.parse('2013-10-20'), # Date | Start date (YYYY-MM-DD). Defaults to 30 days ago.
  _until: Date.parse('2013-10-20'), # Date | End date (YYYY-MM-DD). Defaults to today.
  metric_type: 'time_series', # String | \"total_value\" (default) returns aggregated totals and supports breakdowns. \"time_series\" returns daily values but only works with the \"reach\" metric. 
  breakdown: 'breakdown_example' # String | Breakdown dimension (only valid with metricType=total_value). Valid values depend on the metric: media_product_type, follow_type, follower_type, contact_button_type. 
}

begin
  # Get Instagram insights
  result = api_instance.get_instagram_account_insights(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_instagram_account_insights: #{e}"
end

Using the get_instagram_account_insights_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_instagram_account_insights_with_http_info(account_id, opts)

begin
  # Get Instagram insights
  data, status_code, headers = api_instance.get_instagram_account_insights_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <InstagramAccountInsightsResponse>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_instagram_account_insights_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The Zernio SocialAccount ID for the Instagram account
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=time_series. All other metrics (including follows_and_unfollows) are total_value only. This is an Instagram Graph API limitation, not a Zernio limitation - the IG API does not return time-series data for these metrics. For a daily running follower count, use /v1/analytics/instagram/follower-history instead. [optional]
since Date Start date (YYYY-MM-DD). Defaults to 30 days ago. [optional]
_until Date End date (YYYY-MM-DD). Defaults to today. [optional]
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. [optional][default to 'total_value']
breakdown String Breakdown dimension (only valid with metricType=total_value). Valid values depend on the metric: media_product_type, follow_type, follower_type, contact_button_type. [optional]

Return type

InstagramAccountInsightsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_instagram_demographics

get_instagram_demographics(account_id, opts)

Get Instagram 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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the Instagram account
opts = {
  metric: 'follower_demographics', # String | \"follower_demographics\" for follower audience data, or \"engaged_audience_demographics\" for engaged viewers. 
  breakdown: 'breakdown_example', # String | Comma-separated list of demographic dimensions: age, city, country, gender. Defaults to all four if omitted. 
  timeframe: 'this_week' # String | Time period for demographic data. Defaults to \"this_month\". 
}

begin
  # Get Instagram demographics
  result = api_instance.get_instagram_demographics(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_instagram_demographics: #{e}"
end

Using the get_instagram_demographics_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_instagram_demographics_with_http_info(account_id, opts)

begin
  # Get Instagram demographics
  data, status_code, headers = api_instance.get_instagram_demographics_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <InstagramDemographicsResponse>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_instagram_demographics_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The Zernio SocialAccount ID for the Instagram account
metric String &quot;follower_demographics&quot; for follower audience data, or &quot;engaged_audience_demographics&quot; for engaged viewers. [optional][default to 'follower_demographics']
breakdown String Comma-separated list of demographic dimensions: age, city, country, gender. Defaults to all four if omitted. [optional]
timeframe String Time period for demographic data. Defaults to &quot;this_month&quot;. [optional][default to 'this_month']

Return type

InstagramDemographicsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_instagram_follower_history

get_instagram_follower_history(account_id, opts)

Get Instagram follower history

Returns a daily running Instagram follower count time series, served from Zernio's cross-platform daily snapshotter. Exists because Meta removed follower_count from the /insights endpoint in Graph API v22+ and never exposed a historical daily series via any public API. Response envelope matches /v1/analytics/instagram/account-insights so the same client handling works. Max 89 days, defaults to last 30 days. Requires the Analytics add-on.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the Instagram account.
opts = {
  metrics: 'metrics_example', # String | Comma-separated list. Defaults to \"follower_count,followers_gained,followers_lost\".   - follower_count   : per-day raw follower count   - followers_gained : sum of positive daily deltas   - followers_lost   : sum of absolute negative daily deltas 
  since: Date.parse('2013-10-20'), # Date | Start date (YYYY-MM-DD). Defaults to 30 days ago.
  _until: Date.parse('2013-10-20'), # Date | End date (YYYY-MM-DD). Defaults to today.
  metric_type: 'time_series' # String | \"total_value\" returns aggregated totals (latest for follower_count, sum for gained/lost). \"time_series\" returns per-day values in the \"values\" array. 
}

begin
  # Get Instagram follower history
  result = api_instance.get_instagram_follower_history(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_instagram_follower_history: #{e}"
end

Using the get_instagram_follower_history_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_instagram_follower_history_with_http_info(account_id, opts)

begin
  # Get Instagram follower history
  data, status_code, headers = api_instance.get_instagram_follower_history_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <InstagramAccountInsightsResponse>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_instagram_follower_history_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The Zernio SocialAccount ID for the Instagram account.
metrics String Comma-separated list. Defaults to &quot;follower_count,followers_gained,followers_lost&quot;. - follower_count : per-day raw follower count - followers_gained : sum of positive daily deltas - followers_lost : sum of absolute negative daily deltas [optional]
since Date Start date (YYYY-MM-DD). Defaults to 30 days ago. [optional]
_until Date End date (YYYY-MM-DD). Defaults to today. [optional]
metric_type String &quot;total_value&quot; returns aggregated totals (latest for follower_count, sum for gained/lost). &quot;time_series&quot; returns per-day values in the &quot;values&quot; array. [optional][default to 'total_value']

Return type

InstagramAccountInsightsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_linked_in_aggregate_analytics

get_linked_in_aggregate_analytics(account_id, opts)

Get LinkedIn aggregate stats

Returns aggregate analytics across all posts for a LinkedIn personal account. Only includes posts published through Zernio (LinkedIn API limitation). Org accounts should use /v1/analytics instead. Requires r_member_postAnalytics scope. Saves (POST_SAVE) and sends (POST_SEND) are available for personal accounts; organization pages always return 0 for these two metrics because LinkedIn does not expose them on the organization analytics endpoint.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The ID of the LinkedIn personal account
opts = {
  aggregation: 'TOTAL', # String | TOTAL (default, lifetime totals) or DAILY (time series). MEMBERS_REACHED not available with DAILY.
  start_date: Date.parse('2024-01-01'), # Date | Start date (YYYY-MM-DD). If omitted, returns lifetime analytics.
  end_date: Date.parse('2024-01-31'), # Date | End date (YYYY-MM-DD, exclusive). Defaults to today if omitted.
  metrics: 'IMPRESSION,REACTION,COMMENT,POST_SAVE,POST_SEND' # String | Comma-separated metrics: IMPRESSION, MEMBERS_REACHED, REACTION, COMMENT, RESHARE, POST_SAVE, POST_SEND. Omit for all.
}

begin
  # Get LinkedIn aggregate stats
  result = api_instance.get_linked_in_aggregate_analytics(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_linked_in_aggregate_analytics: #{e}"
end

Using the get_linked_in_aggregate_analytics_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_linked_in_aggregate_analytics_with_http_info(account_id, opts)

begin
  # Get LinkedIn aggregate stats
  data, status_code, headers = api_instance.get_linked_in_aggregate_analytics_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetLinkedInAggregateAnalytics200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_linked_in_aggregate_analytics_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The ID of the LinkedIn personal account
aggregation String TOTAL (default, lifetime totals) or DAILY (time series). MEMBERS_REACHED not available with DAILY. [optional][default to 'TOTAL']
start_date Date Start date (YYYY-MM-DD). If omitted, returns lifetime analytics. [optional]
end_date Date End date (YYYY-MM-DD, exclusive). Defaults to today if omitted. [optional]
metrics String Comma-separated metrics: IMPRESSION, MEMBERS_REACHED, REACTION, COMMENT, RESHARE, POST_SAVE, POST_SEND. Omit for all. [optional]

Return type

GetLinkedInAggregateAnalytics200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_linked_in_org_aggregate_analytics

get_linked_in_org_aggregate_analytics(account_id, opts)

Get LinkedIn organization page aggregate analytics

Returns aggregate analytics for a LinkedIn organization page. Parallel to /v1/accounts/{id}/linkedin-aggregate-analytics (which handles personal accounts only). Backed by LinkedIn's organizationalEntityShareStatistics, organizationalEntityFollowerStatistics, and organizationPageStatistics endpoints. Response shape matches /v1/analytics/instagram/account-insights. Max 89 days, defaults to last 30 days. Requires the Analytics add-on. Scope requirements: r_organization_social, r_organization_followers, and r_organization_admin must all be present on the account. Accounts connected before these scopes were included in the OAuth flow will return 412 with a reauth hint. Enforced by this endpoint: - Page-view metrics accept only metricType=total_value (LinkedIn omits per-day segmentation even when the API is called with DAY granularity, so a time-series response would be meaningless). - Date range capped at 89 days. LinkedIn-side platform limits (not re-enforced here, but worth knowing for larger ranges in a future release): - Follower stats: rolling 12-month window, end must be no later than 2 days ago. - Share stats: rolling 12-month window.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the LinkedIn organization account.
opts = {
  metrics: 'metrics_example', # String | Comma-separated list. Defaults to \"impressions,clicks,engagement_rate,organic_followers_gained,followers_gained,followers_lost\".  Share statistics (support both total_value and time_series):   - impressions   - unique_impressions   - clicks   - likes   - comments   - shares   - engagement_rate       (0..1, LinkedIn-computed)  Follower-gain statistics (support total_value and time_series):   - organic_followers_gained   (per-day organic gains for time_series; sum of organic gains over the range for total_value)   - paid_followers_gained      (per-day paid gains for time_series; sum of paid gains over the range for total_value)  Page-view statistics (total_value ONLY - LinkedIn platform limit):   - page_views_total   - page_views_overview   - page_views_careers   - page_views_jobs   - page_views_life  Zernio-synthesized from daily follower snapshots:   - followers_gained   - followers_lost 
  since: Date.parse('2013-10-20'), # Date | Start date (YYYY-MM-DD). Defaults to 30 days ago.
  _until: Date.parse('2013-10-20'), # Date | End date (YYYY-MM-DD). Defaults to today.
  metric_type: 'time_series' # String | 
}

begin
  # Get LinkedIn organization page aggregate analytics
  result = api_instance.get_linked_in_org_aggregate_analytics(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_linked_in_org_aggregate_analytics: #{e}"
end

Using the get_linked_in_org_aggregate_analytics_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_linked_in_org_aggregate_analytics_with_http_info(account_id, opts)

begin
  # Get LinkedIn organization page aggregate analytics
  data, status_code, headers = api_instance.get_linked_in_org_aggregate_analytics_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <InstagramAccountInsightsResponse>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_linked_in_org_aggregate_analytics_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The Zernio SocialAccount ID for the LinkedIn organization account.
metrics String Comma-separated list. Defaults to &quot;impressions,clicks,engagement_rate,organic_followers_gained,followers_gained,followers_lost&quot;. Share statistics (support both total_value and time_series): - impressions - unique_impressions - clicks - likes - comments - shares - engagement_rate (0..1, LinkedIn-computed) Follower-gain statistics (support total_value and time_series): - organic_followers_gained (per-day organic gains for time_series; sum of organic gains over the range for total_value) - paid_followers_gained (per-day paid gains for time_series; sum of paid gains over the range for total_value) Page-view statistics (total_value ONLY - LinkedIn platform limit): - page_views_total - page_views_overview - page_views_careers - page_views_jobs - page_views_life Zernio-synthesized from daily follower snapshots: - followers_gained - followers_lost [optional]
since Date Start date (YYYY-MM-DD). Defaults to 30 days ago. [optional]
_until Date End date (YYYY-MM-DD). Defaults to today. [optional]
metric_type String [optional][default to 'total_value']

Return type

InstagramAccountInsightsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_linked_in_post_analytics

get_linked_in_post_analytics(account_id, urn)

Get LinkedIn post stats

Returns analytics for a specific LinkedIn post by URN. Works for both personal and organization accounts. Saves and sends are only populated for personal accounts (LinkedIn does not expose these metrics on the organization analytics endpoint).

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The ID of the LinkedIn account
urn = 'urn:li:share:7123456789012345678' # String | The LinkedIn post URN

begin
  # Get LinkedIn post stats
  result = api_instance.get_linked_in_post_analytics(account_id, urn)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_linked_in_post_analytics: #{e}"
end

Using the get_linked_in_post_analytics_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_linked_in_post_analytics_with_http_info(account_id, urn)

begin
  # Get LinkedIn post stats
  data, status_code, headers = api_instance.get_linked_in_post_analytics_with_http_info(account_id, urn)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetLinkedInPostAnalytics200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_linked_in_post_analytics_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The ID of the LinkedIn account
urn String The LinkedIn post URN

Return type

GetLinkedInPostAnalytics200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_linked_in_post_reactions

get_linked_in_post_reactions(account_id, urn, opts)

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).

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The ID of the LinkedIn organization account
urn = 'urn:li:share:7123456789012345678' # String | The LinkedIn post URN
opts = {
  limit: 56, # Integer | Maximum number of reactions to return per page
  cursor: 'cursor_example' # String | Offset-based pagination start index
}

begin
  # Get LinkedIn post reactions
  result = api_instance.get_linked_in_post_reactions(account_id, urn, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_linked_in_post_reactions: #{e}"
end

Using the get_linked_in_post_reactions_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_linked_in_post_reactions_with_http_info(account_id, urn, opts)

begin
  # Get LinkedIn post reactions
  data, status_code, headers = api_instance.get_linked_in_post_reactions_with_http_info(account_id, urn, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetLinkedInPostReactions200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_linked_in_post_reactions_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The ID of the LinkedIn organization account
urn String The LinkedIn post URN
limit Integer Maximum number of reactions to return per page [optional][default to 25]
cursor String Offset-based pagination start index [optional]

Return type

GetLinkedInPostReactions200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_post_timeline

get_post_timeline(post_id, opts)

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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
post_id = 'post_id_example' # String | The post to fetch timeline for. Accepts an ExternalPost ID, a platformPostId, or a Zernio Post ID. 
opts = {
  from_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Start of date range (ISO 8601). Defaults to 90 days ago.
  to_date: Time.parse('2013-10-20T19:20:30+01:00') # Time | End of date range (ISO 8601). Defaults to now.
}

begin
  # Get post analytics timeline
  result = api_instance.get_post_timeline(post_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_post_timeline: #{e}"
end

Using the get_post_timeline_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_post_timeline_with_http_info(post_id, opts)

begin
  # Get post analytics timeline
  data, status_code, headers = api_instance.get_post_timeline_with_http_info(post_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetPostTimeline200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_post_timeline_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
post_id String The post to fetch timeline for. Accepts an ExternalPost ID, a platformPostId, or a Zernio Post ID.
from_date Time Start of date range (ISO 8601). Defaults to 90 days ago. [optional]
to_date Time End of date range (ISO 8601). Defaults to now. [optional]

Return type

GetPostTimeline200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_posting_frequency

get_posting_frequency(opts)

Get 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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
opts = {
  platform: 'platform_example', # String | Filter by platform (e.g. \"instagram\", \"tiktok\"). Omit for all platforms.
  profile_id: 'profile_id_example', # String | Filter by profile ID. Omit for all profiles.
  account_id: 'account_id_example', # String | Filter by social account ID. Omit for all accounts.
  source: 'all' # String | Filter by post origin. \"late\" for posts published via Zernio, \"external\" for posts imported from platforms.
}

begin
  # Get frequency vs engagement
  result = api_instance.get_posting_frequency(opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_posting_frequency: #{e}"
end

Using the get_posting_frequency_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_posting_frequency_with_http_info(opts)

begin
  # Get frequency vs engagement
  data, status_code, headers = api_instance.get_posting_frequency_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetPostingFrequency200Response>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_posting_frequency_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
platform String Filter by platform (e.g. &quot;instagram&quot;, &quot;tiktok&quot;). Omit for all platforms. [optional]
profile_id String Filter by profile ID. Omit for all profiles. [optional]
account_id String Filter by social account ID. Omit for all accounts. [optional]
source String Filter by post origin. &quot;late&quot; for posts published via Zernio, &quot;external&quot; for posts imported from platforms. [optional][default to 'all']

Return type

GetPostingFrequency200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_tik_tok_account_insights

get_tik_tok_account_insights(account_id, opts)

Get TikTok account-level insights

Returns account-level TikTok insights from /v2/user/info/ (live) plus historical time series joined from Zernio's daily snapshotter (AccountStats). Response shape matches /v1/analytics/instagram/account-insights. Max 89 days, defaults to last 30 days. Requires the Analytics add-on and the user.info.stats scope on the account (412 if missing). Scope intentionally narrow. TikTok's public API exposes only the four counter metrics below. The deep metrics that live in TikTok Studio are NOT available on any public TikTok API, even for Business accounts: - profile_views - account-level impressions / reach - follower inflow / outflow breakdown - video watch time, average watch time, full-watched rate - impression_sources (FYP / Following / Hashtag / Search / Personal profile) TikTok's Research API doesn't expose those fields either, and is restricted to non-commercial academic use per TikTok's eligibility policy. There is no public API workaround. Post-level metrics (views, likes, comments, shares per video) are available via /v1/analytics?postId=... from TikTok's /v2/video/query/.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the TikTok account.
opts = {
  metrics: 'metrics_example', # String | Comma-separated list. Defaults to \"follower_count,likes_count,video_count,followers_gained,followers_lost\".  Live from /v2/user/info/ (requires user.info.stats scope):   - follower_count  (cumulative; time series joined from AccountStats)   - following_count (cumulative; time series joined from AccountStats.metadata)   - likes_count     (cumulative; time series joined from AccountStats.metadata)   - video_count     (cumulative; time series joined from AccountStats.metadata)  Zernio-synthesized:   - followers_gained  (sum of positive daily follower deltas)   - followers_lost    (sum of absolute negative daily deltas) 
  since: Date.parse('2013-10-20'), # Date | Start date (YYYY-MM-DD). Defaults to 30 days ago.
  _until: Date.parse('2013-10-20'), # Date | End date (YYYY-MM-DD). Defaults to today.
  metric_type: 'time_series' # String | \"total_value\" returns the latest cumulative counter value. \"time_series\" returns daily values joined from AccountStats snapshots. 
}

begin
  # Get TikTok account-level insights
  result = api_instance.get_tik_tok_account_insights(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_tik_tok_account_insights: #{e}"
end

Using the get_tik_tok_account_insights_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_tik_tok_account_insights_with_http_info(account_id, opts)

begin
  # Get TikTok account-level insights
  data, status_code, headers = api_instance.get_tik_tok_account_insights_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <InstagramAccountInsightsResponse>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_tik_tok_account_insights_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The Zernio SocialAccount ID for the TikTok account.
metrics String Comma-separated list. Defaults to &quot;follower_count,likes_count,video_count,followers_gained,followers_lost&quot;. Live from /v2/user/info/ (requires user.info.stats scope): - follower_count (cumulative; time series joined from AccountStats) - following_count (cumulative; time series joined from AccountStats.metadata) - likes_count (cumulative; time series joined from AccountStats.metadata) - video_count (cumulative; time series joined from AccountStats.metadata) Zernio-synthesized: - followers_gained (sum of positive daily follower deltas) - followers_lost (sum of absolute negative daily deltas) [optional]
since Date Start date (YYYY-MM-DD). Defaults to 30 days ago. [optional]
_until Date End date (YYYY-MM-DD). Defaults to today. [optional]
metric_type String &quot;total_value&quot; returns the latest cumulative counter value. &quot;time_series&quot; returns daily values joined from AccountStats snapshots. [optional][default to 'total_value']

Return type

InstagramAccountInsightsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_you_tube_channel_insights

get_you_tube_channel_insights(account_id, opts)

Get YouTube channel-level insights

Returns channel-scoped aggregate metrics from YouTube Analytics API v2. Saves you from looping /v1/analytics/youtube/daily-views over every video when you only need channel totals. Response shape matches /v1/analytics/instagram/account-insights so the same client handling works. Requires yt-analytics.readonly scope (412 with reauthorizeUrl if missing). Data has a 2-3 day delay (endDate is clamped accordingly). Max 89 days, defaults to last 30 days. Requires the Analytics add-on. NOT exposed: impressions (Studio thumbnail impressions) and impressionsClickThroughRate. YouTube Analytics API v2 does not expose these for any principal type, not channel owners, not Partner Program channels, not content owners with CMS access. The only way to get them is Studio CSV export. This is a Google-side limitation.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the YouTube account.
opts = {
  metrics: 'metrics_example', # String | Comma-separated list. Defaults to \"views,estimatedMinutesWatched,subscribersGained,subscribersLost\".  Live YouTube Analytics v2 metrics:   - views   - estimatedMinutesWatched   - averageViewDuration          (ratio - weighted mean computed across days)   - subscribersGained   - subscribersLost  Zernio-synthesized from daily follower snapshots (cross-platform parity):   - followers_gained   - followers_lost 
  since: Date.parse('2013-10-20'), # Date | Start date (YYYY-MM-DD). Defaults to 30 days ago.
  _until: Date.parse('2013-10-20'), # Date | End date (YYYY-MM-DD). Defaults to today. YouTube Analytics has a 2-3 day delay, so the fetch is internally clamped to 3 days ago; any requested range extending beyond that returns zero values for the tail days. The response's dateRange.until field reflects your requested value. 
  metric_type: 'time_series' # String | \"total_value\" (default) returns aggregated totals. \"time_series\" returns per-day values in the \"values\" array. 
}

begin
  # Get YouTube channel-level insights
  result = api_instance.get_you_tube_channel_insights(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_you_tube_channel_insights: #{e}"
end

Using the get_you_tube_channel_insights_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_you_tube_channel_insights_with_http_info(account_id, opts)

begin
  # Get YouTube channel-level insights
  data, status_code, headers = api_instance.get_you_tube_channel_insights_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <InstagramAccountInsightsResponse>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_you_tube_channel_insights_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The Zernio SocialAccount ID for the YouTube account.
metrics String Comma-separated list. Defaults to &quot;views,estimatedMinutesWatched,subscribersGained,subscribersLost&quot;. Live YouTube Analytics v2 metrics: - views - estimatedMinutesWatched - averageViewDuration (ratio - weighted mean computed across days) - subscribersGained - subscribersLost Zernio-synthesized from daily follower snapshots (cross-platform parity): - followers_gained - followers_lost [optional]
since Date Start date (YYYY-MM-DD). Defaults to 30 days ago. [optional]
_until Date End date (YYYY-MM-DD). Defaults to today. YouTube Analytics has a 2-3 day delay, so the fetch is internally clamped to 3 days ago; any requested range extending beyond that returns zero values for the tail days. The response's dateRange.until field reflects your requested value. [optional]
metric_type String &quot;total_value&quot; (default) returns aggregated totals. &quot;time_series&quot; returns per-day values in the &quot;values&quot; array. [optional][default to 'total_value']

Return type

InstagramAccountInsightsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_you_tube_daily_views

get_you_tube_daily_views(video_id, account_id, opts)

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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
video_id = 'video_id_example' # String | The YouTube video ID (e.g., \"dQw4w9WgXcQ\")
account_id = 'account_id_example' # String | The Zernio account ID for the YouTube account
opts = {
  start_date: Date.parse('2013-10-20'), # Date | Start date (YYYY-MM-DD). Defaults to 30 days ago.
  end_date: Date.parse('2013-10-20') # Date | End date (YYYY-MM-DD). Defaults to 3 days ago (YouTube data latency).
}

begin
  # Get YouTube daily views
  result = api_instance.get_you_tube_daily_views(video_id, account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_you_tube_daily_views: #{e}"
end

Using the get_you_tube_daily_views_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_you_tube_daily_views_with_http_info(video_id, account_id, opts)

begin
  # Get YouTube daily views
  data, status_code, headers = api_instance.get_you_tube_daily_views_with_http_info(video_id, account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <YouTubeDailyViewsResponse>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_you_tube_daily_views_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
video_id String The YouTube video ID (e.g., &quot;dQw4w9WgXcQ&quot;)
account_id String The Zernio account ID for the YouTube account
start_date Date Start date (YYYY-MM-DD). Defaults to 30 days ago. [optional]
end_date Date End date (YYYY-MM-DD). Defaults to 3 days ago (YouTube data latency). [optional]

Return type

YouTubeDailyViewsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_you_tube_demographics

get_you_tube_demographics(account_id, opts)

Get YouTube 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.

Examples

require 'time'
require 'zernio-sdk'
# setup authorization
Zernio.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Zernio::AnalyticsApi.new
account_id = 'account_id_example' # String | The Zernio SocialAccount ID for the YouTube account
opts = {
  breakdown: 'breakdown_example', # String | Comma-separated list of demographic dimensions: age, gender, country. Defaults to all three if omitted. 
  start_date: Date.parse('2013-10-20'), # Date | Start date in YYYY-MM-DD format. Defaults to 90 days ago. 
  end_date: Date.parse('2013-10-20') # Date | End date in YYYY-MM-DD format. Defaults to 3 days ago (YouTube data latency). 
}

begin
  # Get YouTube demographics
  result = api_instance.get_you_tube_demographics(account_id, opts)
  p result
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_you_tube_demographics: #{e}"
end

Using the get_you_tube_demographics_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_you_tube_demographics_with_http_info(account_id, opts)

begin
  # Get YouTube demographics
  data, status_code, headers = api_instance.get_you_tube_demographics_with_http_info(account_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <YouTubeDemographicsResponse>
rescue Zernio::ApiError => e
  puts "Error when calling AnalyticsApi->get_you_tube_demographics_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
account_id String The Zernio SocialAccount ID for the YouTube account
breakdown String Comma-separated list of demographic dimensions: age, gender, country. Defaults to all three if omitted. [optional]
start_date Date Start date in YYYY-MM-DD format. Defaults to 90 days ago. [optional]
end_date Date End date in YYYY-MM-DD format. Defaults to 3 days ago (YouTube data latency). [optional]

Return type

YouTubeDemographicsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json