Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

Commit

Permalink
Add more page and (page) post metrics (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmer0125 committed Oct 7, 2021
1 parent f8e5b83 commit 36cb248
Showing 1 changed file with 225 additions and 0 deletions.
225 changes: 225 additions & 0 deletions python_fb_page_insights_client/fb_page_insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,33 @@ class PostMetric(Enum):
post_reactions_wow_total = auto()
post_reactions_haha_total = auto()

## others ##
post_impressions = auto()
post_impressions_unique = auto()
post_impressions_paid = auto()
post_impressions_paid_unique = auto()
post_impressions_fan = auto()
post_impressions_fan_unique = auto()
post_impressions_fan_paid = auto()
post_impressions_fan_paid_unique = auto()
post_impressions_organic = auto()
post_impressions_viral = auto()
post_impressions_viral_unique = auto()
post_impressions_nonviral = auto()
post_impressions_nonviral_unique = auto()
post_impressions_by_story_type = auto() # by type
post_impressions_by_story_type_unique = auto()

# Page Post Reactions
post_reactions_sorry_total = auto()
post_reactions_anger_total = auto()
post_reactions_by_type_total = auto()

# Stories
post_activity_unique = auto()
post_activity_by_action_type = auto()
post_activity_by_action_type_unique = auto()


post_web_basic_metric_list = [
PostMetric.post_impressions_organic_unique,
Expand Down Expand Up @@ -120,6 +147,204 @@ class PageMetric(Enum):
page_daily_follows_unique = auto()
page_impressions_organic_unique = auto()

## Other ##
# below return is not value, is dict, but has not seen non empty data yet
# https://developers.facebook.com/docs/graph-api/reference/insights/#tab-types
# Page Content
page_tab_views_login_top_unique = auto() # by type
page_tab_views_login_top = auto()
page_tab_views_logout_top = auto()

# Page CTA Clicks
page_cta_clicks_logged_in_total = auto()
page_cta_clicks_logged_in_unique = auto()
page_cta_clicks_by_site_logged_in_unique = auto()
page_cta_clicks_by_age_gender_logged_in_unique = auto()
page_cta_clicks_logged_in_by_country_unique = auto()
page_cta_clicks_logged_in_by_city_unique = auto()
page_call_phone_clicks_logged_in_unique = auto()
page_call_phone_clicks_by_age_gender_logged_in_unique = auto()
page_call_phone_clicks_logged_in_by_country_unique = auto()
page_call_phone_clicks_logged_in_by_city_unique = auto()
page_call_phone_clicks_by_site_logged_in_unique = auto()
page_get_directions_clicks_logged_in_unique = auto()
page_get_directions_clicks_by_age_gender_logged_in_unique = auto()
page_get_directions_clicks_logged_in_by_country_unique = auto()
page_get_directions_clicks_logged_in_by_city_unique = auto()
page_get_directions_clicks_by_site_logged_in_unique = auto()
page_website_clicks_logged_in_unique = auto()
page_website_clicks_by_age_gender_logged_in_unique = auto()
page_website_clicks_logged_in_by_country_unique = auto()
page_website_clicks_logged_in_by_city_unique = auto()
page_website_clicks_by_site_logged_in_unique = auto()

# Page Engagement
page_engaged_users = auto()
page_consumptions = auto()
page_consumptions_unique = auto()
page_consumptions_by_consumption_type = auto() # by type
page_consumptions_by_consumption_type_unique = auto() # by type
page_places_checkin_total = auto()
page_places_checkin_total_unique = auto()
page_places_checkin_mobile = auto()
page_places_checkin_mobile_unique = auto()
page_places_checkins_by_age_gender = auto()
page_places_checkins_by_locale = auto()
page_places_checkins_by_country = auto()
page_negative_feedback = auto()
page_negative_feedback_unique = auto()
page_negative_feedback_by_type = (
auto()
) # by type # https://developers.facebook.com/docs/graph-api/reference/v12.0/insights#negative-feedback-type
page_negative_feedback_by_type_unique = auto()
page_positive_feedback_by_type = (
auto()
) # https://developers.facebook.com/docs/graph-api/reference/v12.0/insights#positive-feedback-types
page_positive_feedback_by_type_unique = auto()
page_fans_online = auto()
page_fans_online_per_day = auto()
page_fan_adds_by_paid_non_paid_unique = auto()

# Page Impressions
page_impressions = auto()
page_impressions_unique = auto()
page_impressions_paid = auto()
page_impressions_paid_unique = auto()
page_impressions_organic = auto()
page_impressions_viral = auto()
page_impressions_viral_unique = auto()
page_impressions_nonviral = auto()
page_impressions_nonviral_unique = auto()
page_impressions_by_story_type = auto()
page_impressions_by_story_type_unique = auto()
page_impressions_by_city_unique = auto()
page_impressions_by_country_unique = auto()
page_impressions_by_locale_unique = auto()
page_impressions_by_age_gender_unique = auto()
page_impressions_frequency_distribution = auto()
page_impressions_viral_frequency_distribution = auto()

# Page Reactions
page_actions_post_reactions_like_total = auto()
page_actions_post_reactions_love_total = auto()
page_actions_post_reactions_wow_total = auto()
page_actions_post_reactions_haha_total = auto()
page_actions_post_reactions_sorry_total = auto()
page_actions_post_reactions_anger_total = auto()
page_actions_post_reactions_total = auto()

# Page User Demographics
page_fans = auto()
page_fans_locale = auto()
page_fans_city = auto()
page_fans_country = auto()
page_fans_gender_age = auto()
page_fans_by_like_source = auto() # by type
page_fans_by_like_source_unique = auto() # by type
page_fan_removes = auto()
page_fan_removes_unique = auto()
page_fans_by_unlike_source = auto() # by type
page_fans_by_unlike_source_unique = auto()

# Page Video Views
page_video_views_paid = auto()
page_video_views_organic = auto()
page_video_views_by_paid_non_paid = auto()
page_video_views_autoplayed = auto()
page_video_views_click_to_play = auto()
page_video_views_unique = auto()
page_video_repeat_views = auto()
page_video_complete_views_30s = auto()
page_video_complete_views_30s_paid = auto()
page_video_complete_views_30s_organic = auto()
page_video_complete_views_30s_autoplayed = auto()
page_video_complete_views_30s_click_to_play = auto()
page_video_complete_views_30s_unique = auto()
page_video_complete_views_30s_repeat_views = auto()

## ??
post_video_complete_views_30s_autoplayed = auto()
post_video_complete_views_30s_clicked_to_play = auto()
post_video_complete_views_30s_organic = auto()
post_video_complete_views_30s_paid = auto()
post_video_complete_views_30s_unique = auto()

page_video_views_10s = auto()
page_video_views_10s_paid = auto()
page_video_views_10s_organic = auto()
page_video_views_10s_autoplayed = auto()
page_video_views_10s_click_to_play = auto()
page_video_views_10s_unique = auto()
page_video_views_10s_repeat = auto()
page_video_view_time = auto()

# Page Views
# page_views_total
page_views_logout = auto()
page_views_logged_in_total = auto()
page_views_logged_in_unique = auto()
page_views_external_referrals = auto()
page_views_by_profile_tab_total = auto()
page_views_by_profile_tab_logged_in_unique = auto()
page_views_by_internal_referer_logged_in_unique = auto()
page_views_by_site_logged_in_unique = auto()
page_views_by_age_gender_logged_in_unique = auto()
page_views_by_referers_logged_in_unique = auto()

# Page Video Posts ??
post_video_avg_time_watched = auto()
post_video_complete_views_organic = auto()
post_video_complete_views_organic_unique = auto()
post_video_complete_views_paid = auto()
post_video_complete_views_paid_unique = auto()
post_video_retention_graph = auto()
post_video_retention_graph_clicked_to_play = auto()
post_video_retention_graph_autoplayed = auto()
post_video_views_organic = auto()
post_video_views_organic_unique = auto()
post_video_views_paid = auto()
post_video_views_paid_unique = auto()
post_video_length = auto()
post_video_views = auto()
post_video_views_unique = auto()
post_video_views_autoplayed = auto()
post_video_views_clicked_to_play = auto()
post_video_views_15s = auto()
post_video_views_60s_excludes_shorter = auto()
post_video_views_10s = auto()
post_video_views_10s_unique = auto()
post_video_views_10s_autoplayed = auto()
post_video_views_10s_clicked_to_play = auto()
post_video_views_10s_organic = auto()
post_video_views_10s_paid = auto()
post_video_views_10s_sound_on = auto()
post_video_views_sound_on = auto()
post_video_view_time = auto()
post_video_view_time_organic = auto()
post_video_view_time_by_age_bucket_and_gender = auto()
post_video_view_time_by_region_id = auto()
post_video_views_by_distribution_type = auto()
post_video_view_time_by_distribution_type = auto()
post_video_view_time_by_country_id = auto()

# Stories
page_content_activity_by_action_type_unique = auto() # by type
page_content_activity_by_age_gender_unique = auto()
page_content_activity_by_city_unique = auto()
page_content_activity_by_country_unique = auto()
page_content_activity_by_locale_unique = auto()
page_content_activity = auto()
page_content_activity_by_action_type = auto() # by type

# Video Ad Breaks
page_daily_video_ad_break_ad_impressions_by_crosspost_status = auto()
page_daily_video_ad_break_cpm_by_crosspost_status = auto()
page_daily_video_ad_break_earnings_by_crosspost_status = auto()

post_video_ad_break_ad_impressions = auto()
post_video_ad_break_earnings = auto()
post_video_ad_break_ad_cpm = auto()


class DebugError(BaseModel):
code: int
Expand Down

0 comments on commit 36cb248

Please sign in to comment.