Published on 2025-06-27T18:53:17Z

What are HTTP Status Codes? Key Categories and Analytics Examples

HTTP status codes are standard three-digit responses issued by servers in response to client requests. They indicate outcomes such as success (2xx), redirection (3xx), client errors (4xx), and server errors (5xx). In web analytics, monitoring status codes is essential for distinguishing valid pageviews from error pages and for pinpointing technical issues that affect user experience. Analytics platforms like Plainsignal and Google Analytics 4 (GA4) can be configured to capture these codes:

Plainsignal example:

<link rel="preconnect" href="//eu.plainsignal.com/" crossorigin />
<script defer data-do="yourwebsitedomain.com" data-id="0GQV1xmtzQQ" data-api="//eu.plainsignal.com" src="//cdn.plainsignal.com/plainsignal-min.js"></script>

GA4 can record status codes via custom events or dimensions in gtag.js or Google Tag Manager. By tracking HTTP status codes alongside pageview data, analysts ensure accurate reporting, optimize site performance, and facilitate swift troubleshooting of broken links or server errors.

Illustration of Http status codes
Illustration of Http status codes

Http status codes

Three-digit server response codes indicating HTTP request results, essential for differentiating successful pageviews, redirects, and errors in analytics.

What are HTTP Status Codes?

Servers return HTTP status codes as three-digit identifiers to inform clients about the result of their requests. These codes provide immediate feedback on success, errors, and required actions during web interactions.

  • Definition

    Three-digit codes returned by servers in response to HTTP requests, indicating outcomes like success, redirection, client errors, or server errors.

  • Role in web analytics

    Status codes help analytics platforms filter valid pageviews from error responses, measure user experience, and detect issues affecting site performance.

Categories of HTTP Status Codes

HTTP status codes are grouped by their first digit into five categories, each representing a different class of response.

  • 1xx: informational

    Indicates that the request was received and is being processed. Rarely used in typical web page interactions.

    • 100 continue:

      Client should continue with its request.

    • 101 switching protocols:

      Server agrees to switch protocols as requested by the client.

  • 2xx: success

    The request was successfully received, understood, and accepted.

    • 200 ok:

      Standard response for successful HTTP requests.

    • 204 no content:

      Request succeeded, but the server returns no content.

  • 3xx: redirection

    Further action must be taken by the user agent to fulfill the request, often via redirects.

    • 301 moved permanently:

      Resource has permanently moved to a new URI.

    • 302 found:

      Resource temporarily resides under a different URI.

  • 4xx: client error

    Client seems to have erred. The request contains bad syntax or cannot be fulfilled.

    • 400 bad request:

      Server cannot process the request due to client error.

    • 404 not found:

      Requested resource could not be found on the server.

  • 5xx: server error

    Server failed to fulfill an apparently valid request.

    • 500 internal server error:

      Generic error when an unexpected condition was encountered.

    • 503 service unavailable:

      Server is not ready to handle the request.

Why HTTP Status Codes matter in Analytics

Tracking HTTP status codes in analytics helps maintain data integrity, enhances user experience analysis, and aids in proactive site performance monitoring.

  • Data quality and accuracy

    Filtering out error status codes ensures that analytics data reflects only successful user interactions.

  • User experience insights

    High rates of 4xx and 5xx codes highlight broken links and server issues impacting visitors.

  • Performance monitoring

    Monitoring redirects (3xx) and error frequencies over time helps identify stability or routing problems.

Capturing HTTP Status Codes in Plainsignal and GA4

Implementing code to record HTTP status codes allows PlainSignal and GA4 to report on server responses alongside pageview and event data.

  • Plainsignal setup

    PlainSignal’s script automatically tracks status codes for each pageview. Include this snippet in your site’s HTML:

    • Plainsignal tracking code:
      <link rel="preconnect" href="//eu.plainsignal.com/" crossorigin />
      <script defer data-do="yourwebsitedomain.com" data-id="0GQV1xmtzQQ" data-api="//eu.plainsignal.com" src="//cdn.plainsignal.com/PlainSignal-min.js"></script>
      
  • Ga4 configuration

    Use gtag.js or Google Tag Manager to send HTTP status codes as custom dimensions or events.

    • Example using gtag.js:
      <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
      <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', 'G-XXXXXXX', { 'send_page_view': false });
        // After obtaining statusCode via fetch or server-rendered variable
        gtag('event', 'page_view', { 'status_code': statusCode });
      </script>
      

Common HTTP Status Codes and Troubleshooting

Recognizing and addressing frequent status codes ensures a smoother user experience and more reliable analytics.

  • 404 not found

    Indicates missing resources. Use analytics alerts to identify broken links and fix URLs promptly.

  • 500 internal server error

    Generic server-side error. Check server logs and monitor error spikes for root cause analysis.

  • 301 moved permanently

    Permanent redirects are crucial for SEO. Ensure analytics captures the final destination URL.


Related terms