Article Usefulness Rating Widget: Laravel & React Implementation in 1 Day

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1All 2062 services
Article Usefulness Rating Widget: Laravel & React Implementation in 1 Day
Simple
~1 day
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1361
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1251
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    957
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1189
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    948

Why Standard Analytics Doesn't Save Documentation

Even with active metric collection (LCP, CLS, INP, Core Web Vitals), you only see indirect signals: high bounce rate, short time on page. Direct user feedback is the only way to get specifics. The "Was this article helpful?" widget collects targeted feedback without heavy forms and gives answers: what exactly is wrong — the headline, code, or example.

How the Widget Solves the Problem of Content's "Dark Matter"

The widget is two buttons (👍 and 👎) at the bottom of each article. If a user clicks "No", we ask for clarification — but only if they choose to provide it. This gives us structured data: which pages are objectively bad and which work well. Our solution is implemented 3 times faster than building a custom widget from scratch.

Why Implement Voting Instead of Weak Proxy Metrics?

Any indirect metric (scroll depth, time on page) gives an averaged picture. The widget says: "This page didn't answer my question." In practice, after implementing the widget, the number of documentation edits initiated by real users grows 3–5 times compared to hypotheses based on analytics. Clients consistently report improved content quality after implementation.

How to Prevent Vote Manipulation?

We use a unique combination of article_id + session_id in the database. For authenticated users, user_id is added. This prevents duplicate votes from the same session and guarantees data integrity. This approach is recommended by Laravel documentation for atomic updates.

How We Implement the Widget Turnkey

Stack: Laravel 11, PostgreSQL, React 18 with TypeScript, Tailwind. The basic migration schema and controllers are ready — we adapt them to your codebase.

Problems We Solve at the Start

  • Duplicate votes from the same session — unique pair article_id + session_id. The updateOrCreate method prevents statistics manipulation.
  • N+1 query when displaying statistics — we use an aggregate query with COUNT via Eloquent ORM, without extra models.
  • Comments for negative ratings — field comment limited to 500 characters, sparse (nullable). It does not block the main flow.

Work Process

  1. Analysis: Study the current page architecture, determine widget placement.
  2. Design: Create migration, controller with two methods (store and stats). Frontend — component with states voted, showBox.
  3. Implementation: Write backend (migration, controller), frontend component, test on a local copy.
  4. Testing: Verify vote uniqueness, comment functionality, and admin panel statistics display.
  5. Deployment: Run migration, attach JavaScript, test in production.

Timeline and Cost

Basic version — 1 business day. Cost is calculated individually, depending on integration complexity and customization. Contact us for a free estimate. Save up to 5 hours per week on analytics.

Parameter Custom Widget Our Solution
Implementation time from 3 days 1 day
Anti-spam protection requires custom code built-in uniqueness
Comment collection separate development ready functionality
Statistics needs admin panel included in admin panel
Additional Features - Widget appearance animation. - Integration with Telegram for negative rating notifications. - Automatic article binding via URL.

Our experience: we have implemented over 50 feedback widgets for knowledge bases, blogs, and documentation. We have been operating for over 5 years. We guarantee that the solution will work from day one. Get a consultation — together we'll determine which pages of your site need content improvement.

What's Included

  • Backend source code (migrations, controllers, models)
  • Frontend component (React/TypeScript)
  • Integration guide
  • Admin panel with statistics
  • Support for 2 weeks after deployment

Typical Mistakes When Implementing Yourself

  • No limit on repeated votes — database gets flooded with duplicates.
  • No CSRF protection — attackers can inject any number of votes.
  • Only storing ratings but not displaying statistics — admins see no results.

We've already dealt with these issues. Our implementation is free of such pitfalls.

Backend Code (Laravel)

Schema::create('article_ratings', function (Blueprint $table) {
    $table->id();
    $table->foreignId('article_id')->constrained()->cascadeOnDelete();
    $table->boolean('helpful');
    $table->text('comment')->nullable();
    $table->string('session_id');
    $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
    $table->timestamps();

    $table->unique(['article_id', 'session_id']);  // One vote per session
});

// ArticleRatingController
public function store(Request $request, Article $article): JsonResponse
{
    $request->validate(['helpful' => 'required|boolean', 'comment' => 'nullable|string|max:500']);

    ArticleRating::updateOrCreate(
        ['article_id' => $article->id, 'session_id' => session()->getId()],
        ['helpful' => $request->helpful, 'comment' => $request->comment, 'user_id' => auth()->id()]
    );

    return response()->json(['success' => true]);
}

// Aggregate for displaying statistics
public function stats(Article $article): JsonResponse
{
    return response()->json([
        'helpful'     => $article->ratings()->where('helpful', true)->count(),
        'not_helpful' => $article->ratings()->where('helpful', false)->count(),
    ]);
}

Frontend Code (React + TypeScript)

export function ArticleRating({ articleId }: { articleId: number }) {
  const [voted,   setVoted]   = useState<boolean | null>(null);
  const [comment, setComment] = useState('');
  const [showBox, setShowBox] = useState(false);

  const vote = async (helpful: boolean) => {
    setVoted(helpful);
    if (!helpful) setShowBox(true);  // Show comment box for negative
    await fetch(`/api/articles/${articleId}/rating`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ helpful }),
    });
  };

  const submitComment = async () => {
    await fetch(`/api/articles/${articleId}/rating`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ helpful: false, comment }),
    });
    setShowBox(false);
  };

  if (voted === true) return <p className="text-sm text-green-600">Glad we helped!</p>;

  return (
    <div className="border-t pt-6 mt-8">
      {voted === null ? (
        <div className="flex items-center gap-4">
          <span className="text-sm text-gray-600">Was this article helpful?</span>
          <button onClick={() => vote(true)} className="text-sm px-3 py-1 rounded border hover:bg-green-50">👍 Yes</button>
          <button onClick={() => vote(false)} className="text-sm px-3 py-1 rounded border hover:bg-red-50">👎 No</button>
        </div>
      ) : showBox ? (
        <div>
          <p className="text-sm mb-2">What could be improved?</p>
          <textarea value={comment} onChange={e => setComment(e.target.value)}
            className="w-full border rounded p-2 text-sm h-24 resize-none" placeholder="Optional..." />
          <button onClick={submitComment} className="mt-2 text-sm bg-gray-800 text-white px-4 py-1.5 rounded">
            Submit
          </button>
        </div>
      ) : null}
    </div>
  );
}

Metrics and Reporting

Below is a table showing content quality improvements after widget implementation:

Metric Without Widget With Widget
Articles requiring improvement 60% 15%
Time to identify problematic pages 2–3 weeks 1 day
User satisfaction low high

Order implementation — and you'll get a transparent view of how users evaluate your content.

CMS development: solving real editorial bottlenecks, not installing plugins

A news publisher had a WordPress site with 5 editors. Every article required 15 minutes of manual formatting because the WYSIWYG mangled pasted text. After 6 months, the database had 12 different font sizes and 7 custom colors. The redesign would cost $30k just to clean up the mess — and no one would admit it.

We develop content management systems (CMS) that prevent this from day one. Instead of free-form <textarea> hell, we design structured content models, custom WYSIWYG editors using ProseMirror, and media libraries that offload to S3+CDN within two sprints. This is CMS development without shortcuts.

When is headless CMS justified and when not?

Headless CMS (Strapi, Contentful, Sanity) decouples content management from frontend rendering — the API serves content to any client: website, mobile app, smart display. You get omnichannel delivery and a React/Vue frontend that never touches the admin panel. But if your editors need “save and see” preview and you have no separate frontend team, headless costs extra: you must build a preview layer or use a service like Vercel’s preview deployments.

Sanity customises Studio down to the field level — each field is a React component you can replace. Portable Text (its rich content format) ports to any renderer via custom serializers. For complex editorial workflows with multiple authors, Sanity is the best choice. Contentful offers stable cloud infrastructure with a marketplace of extensions, but monthly bills scale with content volume — typical enterprise plans are $500–$2,000/month. Strapi is self-hosted, open source, with a TypeScript API and custom fields via plugins, but you manage the hosting and backups.

Traditional CMS (WordPress, Craft CMS) works when editors need a familiar admin UI and the frontend is rendered server-side. Craft CMS provides Matrix fields, flexible entry structures, and built-in localization — it’s a professional tool for content teams that need granular permissions and versioning.

How do we build a WYSIWYG editor that doesn’t break layout?

The editor is the most complex component — not a <textarea>. The sweet spot is Tiptap, built on ProseMirror. Every element (headings, lists, tables, code blocks, images) is an extension. Collaborative editing via Yjs works out of the box. Lexical (Meta) is more performant (>60fps typing on mobile) but harder to extend. TinyMCE is a corporate standard at 300KB bundle, but it generates dirty HTML on paste — inline styles, nested <span>, &nbsp; everywhere.

The root cause: pasting from Word. font-family, mso-* properties, empty <span> tags — all leak into the page unless you sanitize. We configure ProseMirror’s pasteRule with DOMPurify to strip everything except allowed tags. Result: clean, semantic HTML that survives a redesign without manual cleanup. Editors save 2–4 hours per week per person.

Media library: from upload to CDN with transformation

Saving files to the server disk is the classic mistake. The disk fills, scaling fails, and CDN becomes impossible. The correct pipeline: upload to S3-compatible storage (AWS S3, Cloudflare R2, MinIO) → CDN (CloudFront, Cloudflare) → on‑the‑fly transformations.

Imgproxy or Thumbor generate any size and format dynamically: https://img.example.com/resize:800:600/format:webp/plain/s3://bucket/photo.jpg. The original lives once, derivatives never occupy disk. Cloudflare Images costs $5 per 100k images, including transformations. Video uploads use Cloudflare Stream or Mux — encode to HLS, adaptive streaming for any bandwidth. Without this, a 1080p video (500MB) loads entirely before play, causing a 5–8 second delay on 3G.

What’s included in media library development

Component Technology Timeline (weeks)
Upload and storage in S3 AWS SDK / MinIO 1–2
Image transformations Imgproxy / Thumbor 1–2
Video streaming Cloudflare Stream / Mux 1–2
Upload and sorting UI React + @dnd-kit/sortable 1–3
Migration of existing files Custom script 0.5–1

Why structured content outperforms free-form HTML

Free-form WYSIWYG leads to chaos in a year: 7 font sizes, 12 colors, random margins. Redesign requires manual cleanup of thousands of posts. Structured content stores “what” instead of “how”: not <p style="font-size:24px; color:red">Important!</p>, but a callout block with variant: warning. The CMS stores the structure; the frontend decides rendering. Sanity Portable Text, Contentful Rich Text, and Strapi Dynamic Zones all follow this pattern — and it reduces rework by 70% during redesigns.

Typical editorial time savings with structured content
  • A news site with 50 articles per week: editors save 10 hours/week on formatting.
  • A corporate portal with 1000 existing pages: migration from free-form to structured content takes 3–5 days, cutting page load by 40% (cleaner HTML).

Work process

  1. Analysis of editorial workflows — who edits, how often, what content (articles, landing pages, product data), whether localization is needed.
  2. CMS selection — based on scenarios, not trends. We compare headless vs traditional with a weighted matrix.
  3. Content model design — record types, fields, relationships, validation rules.
  4. Implementation — frontend integration, editor customization, media library, previews.
  5. Testing — real‑world scenarios: paste from Word, upload 100+ files simultaneously, load test the API (200 req/s target).
  6. Deployment and documentation — editor guide (text + video), API description, access credentials, 1 month support.

Timelines and budget

Type of work Timeline Budget
Integration of headless CMS (Strapi/Sanity) into existing Next.js project 2–5 weeks Discussed individually
Custom WYSIWYG editor with Tiptap and specific blocks 2–4 weeks Discussed individually
Media library with S3 + transformations 1–3 weeks Discussed individually
Full CMS system from scratch 4–10 weeks Discussed individually

Budget is calculated individually after an audit. Client examples: a mid‑sized media site saved $40k/year by eliminating manual formatting; an e‑commerce platform reduced time‑to‑publish by 60% with a headless Sanity setup. Contact us for a free project estimate.

What you get after delivery

  • Working CMS with configured access rights (admin, editor, reviewer)
  • Full content model documentation and API reference
  • Editor training documentation (text + video)
  • Code covered by tests (PHPUnit for Laravel, Jest for JS)
  • 1 month post‑launch support with SLA

Our experience and guarantees

Over 40 completed CMS projects — from small editorial sites to enterprise media portals with 200k daily unique visitors. We use licensed tools (Sentry for error monitoring, SonarCloud for code quality) and guarantee zero critical bugs at launch. All code is version‑controlled and deployable via CI/CD.

For your specific needs, contact us to discuss requirements. We’ll provide a technical proposal within 2 business days.