Thuta Learning
ရှာဖွေရန်
AdvancedWeb Developmentintermediate

SEO၊ Logs နှင့် Web Vitals

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • SEO technical baseline တည်ဆောက်ရန်
  • Useful logs နှင့် sensitive data ကိုခွဲရန်
  • Web Vitals ကိုစောင့်ကြည့်ရန်

Deploy လုပ်ပြီးနောက် user တစ်ယောက်မှာ error တက်တာကို သူပြောမှသိရင် ပြင်ရနောက်ကျပါတယ်။ Production app တစ်ခုမှာ search engine အတွက် metadata နဲ့ developer အတွက် logs/metrics နှစ်မျိုးလုံးလိုပါတယ်။

နားလည်ထားရမယ့် အချက်

Title၊ description၊ canonical URL၊ sitemap၊ robots နဲ့ Open Graph image ကို route structure နဲ့ကိုက်ညီအောင်ထားပါ။ Error log မှာ request context နဲ့ error digest လို debugging အတွက်လိုတာထည့်ပေမယ့် password၊ token၊ cookie နဲ့ personal content ကို မထည့်ပါနဲ့။ useReportWebVitals သို့မဟုတ် hosting provider analytics ဖြင့် LCP၊ INP နဲ့ CLS ကို real user များဆီက စောင့်ကြည့်ပြီး release မတိုင်မီနဲ့ပြီးနောက် နှိုင်းယှဉ်ပါ။

အတူတူ စမ်းရေးကြည့်မယ်

tsx
"use client";
import { useReportWebVitals } from "next/web-vitals";

export function WebVitals() {
  useReportWebVitals((metric) => {
    navigator.sendBeacon(
      "/api/vitals",
      JSON.stringify({ name: metric.name, value: metric.value }),
    );
  });
  return null;
}

Code က ဘယ်လိုအလုပ်လုပ်သလဲ

WebVitals component က browser မှ metric တစ်ခုချင်းရလာချိန် analytics endpoint ဆီပို့နိုင်ပါတယ်။ Production မှာ sampling၊ retry နဲ့ privacy policy ကိုထပ်စဉ်းစားရပါမယ်။

You should see
Browser မှ Web Vital metrics များကို monitoring endpoint သို့ပို့နိုင်မည်။

၅ မိနစ် စမ်းကြည့်

Production dashboard မှာ error rate၊ LCP နဲ့ deployment version သုံးခုကို တစ်နေရာတည်းကြည့်နိုင်မယ့် monitoring plan ရေးပါ။

Next.js — Production ChecklistNext.js

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Log ထဲ token သို့မဟုတ် user content အပြည့်ထည့်ခြင်း
  • Metric တက်လာတာကို deployment version နဲ့မချိတ်ဘဲ ကြည့်ခြင်း

လေ့ကျင့်ခန်း

Production dashboard မှာ error rate၊ LCP နဲ့ deployment version သုံးခုကို တစ်နေရာတည်းကြည့်နိုင်မယ့် monitoring plan ရေးပါ။

You'll know it worked when: Browser မှ Web Vital metrics များကို monitoring endpoint သို့ပို့နိုင်မည်။

SEO၊ Logs နှင့် Web Vitals | Thuta Learning