Class: Posthubify::PlatformAnalyticsResource

Inherits:
Object
  • Object
show all
Defined in:
lib/posthubify/resources/analytics.rb

Overview

Platform-specific analytics (Node sdk .platformAnalytics) — live data via the account connector.

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ PlatformAnalyticsResource

Returns a new instance of PlatformAnalyticsResource.



36
37
38
# File 'lib/posthubify/resources/analytics.rb', line 36

def initialize(http)
  @http = http
end

Instance Method Details

#facebook_page_insights(account_id) ⇒ Object

Facebook Page insights (current metric names as of November 2025).



47
48
49
# File 'lib/posthubify/resources/analytics.rb', line 47

def facebook_page_insights()
  @http.data('GET', '/analytics/facebook/page-insights', query: { 'accountId' =>  })
end

#instagram_demographics(account_id) ⇒ Object

Instagram audience demographics (age/gender/country/city; Meta requires min 100 followers).



57
58
59
# File 'lib/posthubify/resources/analytics.rb', line 57

def instagram_demographics()
  @http.data('GET', '/analytics/instagram/demographics', query: { 'accountId' =>  })
end

#instagram_follower_history(account_id:, days: nil) ⇒ Object

Instagram daily follower history (from our own snapshot store; Meta does not provide a historical series).



41
42
43
44
# File 'lib/posthubify/resources/analytics.rb', line 41

def instagram_follower_history(account_id:, days: nil)
  @http.data('GET', '/analytics/instagram/follower-history',
             query: { 'accountId' => , 'days' => days })
end

#instagram_insights(account_id) ⇒ Object

Instagram account insights (reach/views/accounts_engaged/total_interactions…).



52
53
54
# File 'lib/posthubify/resources/analytics.rb', line 52

def instagram_insights()
  @http.data('GET', '/analytics/instagram/insights', query: { 'accountId' =>  })
end

#instagram_stories(account_id) ⇒ Object

Active Instagram stories (24-hour window).



62
63
64
# File 'lib/posthubify/resources/analytics.rb', line 62

def instagram_stories()
  @http.data('GET', '/analytics/instagram/stories', query: { 'accountId' =>  })
end

#instagram_story_insights(account_id, story_id) ⇒ Object

Story metrics + navigation breakdown (tapsForward/tapsBack/exits/swipesForward).



67
68
69
70
# File 'lib/posthubify/resources/analytics.rb', line 67

def instagram_story_insights(, story_id)
  @http.data('GET', "/analytics/instagram/stories/#{story_id}/insights",
             query: { 'accountId' =>  })
end

#linkedin_org_aggregate(account_id) ⇒ Object

LinkedIn organization page statistics (12-month window; engagement=rate).



88
89
90
# File 'lib/posthubify/resources/analytics.rb', line 88

def linkedin_org_aggregate()
  @http.data('GET', '/analytics/linkedin/org-aggregate', query: { 'accountId' =>  })
end

#linkedin_post_reactions(account_id, post_id) ⇒ Object

LinkedIn post reaction breakdown.



98
99
100
101
# File 'lib/posthubify/resources/analytics.rb', line 98

def linkedin_post_reactions(, post_id)
  @http.data('GET', "/analytics/linkedin/post-reactions/#{post_id}",
             query: { 'accountId' =>  })
end

#pinterest_account_insights(account_id) ⇒ Object

Pinterest account insights (last 30 days: impression/save/pin-click/outbound-click/engagement + followers).



93
94
95
# File 'lib/posthubify/resources/analytics.rb', line 93

def ()
  @http.data('GET', '/analytics/pinterest/account-insights', query: { 'accountId' =>  })
end

#tiktok_account_insights(account_id) ⇒ Object

TikTok account insights (follower/like/video counts — current totals).



73
74
75
# File 'lib/posthubify/resources/analytics.rb', line 73

def ()
  @http.data('GET', '/analytics/tiktok/account-insights', query: { 'accountId' =>  })
end

#youtube_channel_insights(account_id) ⇒ Object

YouTube channel insights (cumulative + 28-day Analytics metrics).



78
79
80
# File 'lib/posthubify/resources/analytics.rb', line 78

def youtube_channel_insights()
  @http.data('GET', '/analytics/youtube/channel-insights', query: { 'accountId' =>  })
end

#youtube_demographics(account_id) ⇒ Object

YouTube viewer demographics (age×gender percentages + country breakdown).



83
84
85
# File 'lib/posthubify/resources/analytics.rb', line 83

def youtube_demographics()
  @http.data('GET', '/analytics/youtube/demographics', query: { 'accountId' =>  })
end