频道统计
Telegram 提供频道和超级群组的详细频道统计数据。
频道统计
模式:
statsDateRangeDays#b637edaf min_date:int max_date:int = StatsDateRangeDays;statsAbsValueAndPrev#cb43acde current:double previous:double = StatsAbsValueAndPrev;statsPercentValue#cbce2fe0 part:double total:double = StatsPercentValue;statsGraphAsync#4a27eb2d token:string = StatsGraph; statsGraphError#bedc9822 error:string = StatsGraph; statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph;postInteractionCountersMessage#e7058e7f msg_id:int views:int forwards:int reactions:int = PostInteractionCounters; postInteractionCountersStory#8a480e27 story_id:int views:int forwards:int reactions:int = PostInteractionCounters;stats.broadcastStats#396ca5fc period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev reactions_per_post:StatsAbsValueAndPrev views_per_story:StatsAbsValueAndPrev shares_per_story:StatsAbsValueAndPrev reactions_per_story:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph reactions_by_emotion_graph:StatsGraph story_interactions_graph:StatsGraph story_reactions_by_emotion_graph:StatsGraph recent_posts_interactions:Vector<PostInteractionCounters> = stats.BroadcastStats;messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull; channelFull#e4e0b29d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true paid_messages_available:flags2.20?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int send_paid_messages_stars:flags2.21?long main_tab:flags2.22?ProfileTab = ChatFull;---functions---stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats; stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
达到一定规模(具体规模限制由服务器端配置决定,通过channelFull标志返回)的频道管理员可以调用stats.getBroadcastStats获取详细的频道统计信息。该查询必须发送到具有指定 ID 的数据中心,该 ID 可通过channels.getFullChannel获取。返回的stats.broadcastStats包含多个统计信息:can_view_stats
channelFull.stats_dc
-
周期相关统计数据:一对数值,一个位于所考虑周期的开始,另一个位于该周期的结束(period)。
通常period取决于渠道活动。- 绝对关注者数量(followers)
-
total_viewcount/postcount,适用于在考虑期间(views_per_post)内发布的帖子。
请注意,在这种情况下,current指的是period考虑期间(min_date截至max_date),而prev指的是上一个期间((min_date - (max_date - min_date))截至min_date)。 -
total_sharecount/postcount,适用于在考虑期间(shares_per_post)内发布的帖子。
请注意,在这种情况下,current指的是period考虑期间(min_date截至max_date),而prev指的是上一个期间((min_date - (max_date - min_date))截至min_date)。
-
百分比统计数据
- 已启用通知的订阅用户百分比(enabled_notifications)
- 图表:图表描述如下 »。
超级组统计数据
模式:
statsGroupTopPoster#9d04af9b user_id:long messages:int avg_chars:int = StatsGroupTopPoster; statsGroupTopInviter#535f779d user_id:long invitations:int = StatsGroupTopInviter; statsGroupTopAdmin#d7584c87 user_id:long deleted:int kicked:int banned:int = StatsGroupTopAdmin;stats.megagroupStats#ef7ff916 period:StatsDateRangeDays members:StatsAbsValueAndPrev messages:StatsAbsValueAndPrev viewers:StatsAbsValueAndPrev posters:StatsAbsValueAndPrev growth_graph:StatsGraph members_graph:StatsGraph new_members_by_source_graph:StatsGraph languages_graph:StatsGraph messages_graph:StatsGraph actions_graph:StatsGraph top_hours_graph:StatsGraph weekdays_graph:StatsGraph top_posters:Vector<StatsGroupTopPoster> top_admins:Vector<StatsGroupTopAdmin> top_inviters:Vector<StatsGroupTopInviter> users:Vector<User> = stats.MegagroupStats;messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull; channelFull#e4e0b29d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true paid_messages_available:flags2.20?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int send_paid_messages_stars:flags2.21?long main_tab:flags2.22?ProfileTab = ChatFull;---functions---stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats;channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
达到一定规模的超级组(具体规模限制由服务器端配置决定,通过channelFullcan_view_stats标志返回)的管理员可以调用stats.getMegagroupStats获取详细的超级组统计信息。该查询必须发送到具有指定 ID 的数据中心,该 ID可通过channels.getFullChannel获取。返回的stats.broadcastStats包含多个统计信息,更多信息请参阅构造函数页面 »。
channelFull.stats_dc
消息统计信息
stats.messageStats#7fe91c14 views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.MessageStats;messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull; channelFull#e4e0b29d flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true paid_messages_available:flags2.20?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int send_paid_messages_stars:flags2.21?long main_tab:flags2.22?ProfileTab = ChatFull;---functions---stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;stats.getMessagePublicForwards#5f150144 channel:InputChannel msg_id:int offset:string limit:int = stats.PublicForwards;
拥有一定规模频道(具体规模限制由服务器端配置决定,通过channelFullcan_view_stats标志返回)的管理员可以调用stats.getMessageStats来获取特定消息的统计信息。该查询必须发送到具有指定 ID 的数据中心,该 ID 可通过channels.getFullChannel获取。返回的stats.messageStats包含该消息的视图图。
channelFull.stats_dc
stats.getMessagePublicForwards也可用于获取消息列表,指示频道消息转发到哪些其他公共频道:它将返回一个消息列表,其中peer_id等于此消息转发到的公共频道。
故事统计
stats.storyStats#50cd067c views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.StoryStats;publicForwardMessage#1f2bf4a message:Message = PublicForward; publicForwardStory#edf3add0 peer:Peer story:StoryItem = PublicForward;stats.publicForwards#93037e20 flags:# count:int forwards:Vector<PublicForward> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = stats.PublicForwards;---functions---stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = stats.StoryStats;stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards;
使用stats.getStoryStats获取有关故事的统计信息。
使用stats.getStoryPublicForwards获取故事的转发信息,包括以消息形式发送到公共聊天室和通过公共频道转发的信息。
图形可视化
图表类型共有四种可视化方式:
- 折线图
- 阶梯图
- 条形图
- 面积图
图形修饰符(参见各种图形示例):
- y_scaled表示阶梯图中的两条线(!)必须分别用各自的刻度来表示,图表的左右两侧分别使用不同的刻度轴。
- percentage- 指示是否应在标签中显示数值百分比
- stacked- 根据图表类型,表示同一图表中多列的堆叠。
图语法
statsGraphAsync#4a27eb2d token:string = StatsGraph; statsGraphError#bedc9822 error:string = StatsGraph; statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph;dataJSON#7d748d04 data:string = DataJSON;---functions---stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
为了减少服务器负载,某些图表不会直接在stats.broadcastStats构造函数中发送:相反,这些图表将作为statsGraphAsync构造函数发送,并且应该使用stats.loadAsyncGraph单独获取。
获取完整的statsGraph构造函数后,客户端应解析字段中的 JSON 图对象json。
对象结构:
| 钥匙 | 图表标题 |
|---|---|
| 列 | 图表中所有数据列数组的集合。每个列数组的标签位于位置 0,后面跟着值。 |
| 类型 |
每列数组的图形类型"label": "type"(对象): -line-折线图 -area-面积图 -step-阶梯图 -bar-条形图 - -x每个图表在相应位置的 x 轴值,UNIX 时间戳(毫秒)。 |
| 颜色 | 每种类型(对象)的颜色"label": "colorKey#AAAAAA";请参阅图表颜色。 |
| 姓名 | 每个变量(对象"label": "Name")的本地化名称 |
| 子图 |
该对象指示图表的默认缩放范围,其结构如下: -show是否使用指定的缩放范围(布尔值) -defaultZoom一个包含两个值的数组x,分别指示默认缩放范围的两端。 |
| y_scaled | 表示阶梯图中的两条线(!)必须分别用各自的刻度来表示,图表的左侧和右侧各有两个不同的刻度轴(布尔值,请参阅各种图表示例)。 |
| 百分比 | 指示是否应在标签中显示数值百分比(布尔值,请参阅各种图表示例) |
| 堆叠 | 根据图表类型,指示同一图表中多列的堆叠(布尔值,请参阅各种图表示例) |
以下图表限制适用:
- 一张图表最多应支持 50 列。
- 图表中每一列的图表类型始终相同。
- 图表bar类型和stacked选项总是一起使用。
- percentage总是与area图表一起使用。
图表缩放
statsGraphError#bedc9822 error:string = StatsGraph; statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph;dataJSON#7d748d04 data:string = DataJSON;---functions---stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
支持缩放的图表会在`statsGraph`zoom_token构造函数中包含一个标记。该标记应在用户点击图表中与特定 x 轴相关的标签时触发的`stats.loadAsyncGraph`调用中使用(参见图表示例)。标签的坐标应作为参数提供;该方法随后将返回(如果可用)更详细的子图。如果数据不足,则会返回 局部化的`statsGraphError` 错误。
token
xx
典型的缩放可视化规则:
- 任何percentage图表(即使zoom_token没有 a 选项)=>饼图
- 折线图=>折线图
- 阶梯图=>阶梯图
- 条形图=>条形图
- 面积图=>面积图
图表颜色
图表颜色可以以颜色键的形式提供,后跟十六进制格式的主颜色值:
red#e05356
颜色键可以是以下之一:red,,,,,,,lightblue。应用程序可以选择使用当前加载的主题指定的颜色值:例如,Android 应用程序为每个颜色键使用主题键,请查看assets目录以获取一系列具有各种颜色的默认主题,用于频道统计信息lightgreen。goldengreenorangeblueindigo
statisticChartLine_*
但是,服务器也可以选择仅返回十六进制格式的纯颜色值:
#e05356在这种情况下,可以使用stats.getBroadcastStatsdark方法的标志来选择返回颜色的调色板。
图表示例
折线图
简单的单线图
阶梯图
阶梯图,总是“堆叠”的(表示多条线)
条形图
多线条形图,始终“堆叠”(表示实际堆叠的条形,最大的条形排在最前面)
面积图
混合柱状图/折线图,始终“堆叠”(表示实际堆叠的柱状图,最大的柱状图在前)
皮查特
饼图通常只有在放大百分比图表时才会出现。