diff --git a/src/app/(console)/insights/page.tsx b/src/app/(console)/insights/page.tsx
index 7a0584e..27378fa 100644
--- a/src/app/(console)/insights/page.tsx
+++ b/src/app/(console)/insights/page.tsx
@@ -95,9 +95,9 @@ export default async function InsightsPage() {
| โพสต์ |
เพจ |
- Impressions |
- Engaged |
- Reactions |
+ ยอดดู |
+ คลิก |
+ รีแอคชัน |
diff --git a/src/lib/facebook/insights.ts b/src/lib/facebook/insights.ts
index 0a0830d..6219455 100644
--- a/src/lib/facebook/insights.ts
+++ b/src/lib/facebook/insights.ts
@@ -33,21 +33,24 @@ export async function getPageDailyInsights(page: PageCredentials) {
}
/**
- * Metric names here are unverified against the current Graph version — if
- * Meta rejects one, swap it and keep `raw` so history can be re-derived.
+ * post_impressions / post_engaged_users / post_impressions_unique are
+ * deprecated ("(#100) The value must be a valid insights metric"; verified
+ * against a live page on 2026-11-29). Replacements: post_media_view (views)
+ * is stored in `impressions`, post_clicks in `engaged`. DB column names are
+ * kept so existing history stays comparable; `raw` keeps the full response.
*/
export async function getPostInsights(page: PageCredentials, fbPostId: string) {
const id = fbPostId.includes("_") ? fbPostId : `${page.fbPageId}_${fbPostId}`;
const res = await graphGet(`/${id}/insights`, page.token, {
- metric: "post_impressions,post_engaged_users,post_reactions_by_type_total",
+ metric: "post_media_view,post_clicks,post_reactions_by_type_total",
});
const data: InsightMetric[] = res.data ?? [];
const reactionsRaw = data.find((d) => d.name === "post_reactions_by_type_total")?.values?.[0]?.value;
const reactions =
reactionsRaw && typeof reactionsRaw === "object" ? Object.values(reactionsRaw).reduce((a, b) => a + b, 0) : 0;
return {
- impressions: latest(data, "post_impressions"),
- engaged: latest(data, "post_engaged_users"),
+ impressions: latest(data, "post_media_view"),
+ engaged: latest(data, "post_clicks"),
reactions,
raw: res,
};