Error Sessions Analysis (JavaScript Errors)

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
Error Sessions Analysis (JavaScript Errors)
Medium
from 1 day to 3 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1358
  • 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
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • 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
    947

Error Sessions Analysis (JavaScript Errors)

Imagine: a user adds a product to the cart, clicks "Checkout" — and nothing happens. The console is full of Cannot read property 'X' of undefined, the checkout freezes. You lose money, and the user goes to a competitor. We help identify such errors and eliminate them before they zero out your metrics.

Error Sessions are sessions where one or more JavaScript errors occurred. Our experience shows: without systematic analysis, you miss 60–80% of critical bugs that directly cut conversion. We filter, analyze, and prioritize these sessions using Sentry and GA4. Sentry with Replay speeds up debugging by 5–10 times compared to simple logging.

Setting Up JavaScript Error Interception

We intercept all unhandled errors, Promise rejections, and failed fetch/XHR requests. The key element is proper source maps configuration: Sentry automatically deobfuscates the stack, showing the original source code rather than minified strings. Integration example:

// Intercept unhandled errors
window.addEventListener('error', function(event) {
  const errorInfo = {
    message: event.message,
    source: event.filename?.split('/').pop(),
    line: event.lineno,
    col: event.colno,
    stack: event.error?.stack?.slice(0, 500),
    page: window.location.pathname,
    user_agent: navigator.userAgent.slice(0, 100)
  }

  // Send to GA4
  gtag('event', 'js_error', errorInfo)

  // Send to Sentry/Bugsnag
  Sentry.captureException(event.error, {
    extra: errorInfo
  })
})

// Intercept unhandled Promise rejections
window.addEventListener('unhandledrejection', function(event) {
  gtag('event', 'promise_rejection', {
    message: event.reason?.message || String(event.reason),
    page: window.location.pathname
  })
})

// Intercept errors in fetch/XHR
const originalFetch = window.fetch
window.fetch = async function(...args) {
  try {
    const response = await originalFetch(...args)
    if (!response.ok) {
      gtag('event', 'fetch_error', {
        url: args[0].toString().split('?')[0],
        status: response.status,
        page: window.location.pathname
      })
    }
    return response
  } catch (err) {
    gtag('event', 'fetch_exception', {
      url: args[0].toString().split('?')[0],
      message: err.message
    })
    throw err
  }
}

For more details on window.onerror, see the MDN documentation. According to Sentry documentation, integration with source maps and Replay speeds up debugging by 5–10 times compared to regular logging.

Integrating Sentry with Replay and Tracing

For in-depth analysis, we integrate Sentry with Replay and Tracing. Replay records the session up to the error moment, allowing you to see user actions. Example configuration:

// sentry.init.js
import * as Sentry from '@sentry/browser'
import { BrowserTracing } from '@sentry/tracing'

Sentry.init({
  dsn: 'https://[email protected]/yyy',
  integrations: [
    new BrowserTracing(),
    new Sentry.Replay({
      maskAllText: false,
      blockAllMedia: false
    })
  ],
  tracesSampleRate: 0.1,   // 10% for performance
  replaysSessionSampleRate: 0.05,  // 5% of sessions to record
  replaysOnErrorSampleRate: 1.0,   // 100% on error

  beforeSend(event) {
    // Add user context
    event.user = {
      id: currentUser?.id,
      segment: currentUser?.plan
    }
    return event
  }
})

How Errors Affect Conversion

We build SQL queries comparing CVR of sessions with and without errors. Typical result: sessions with errors convert 3+ times worse. Example code:

def analyze_error_impact(analytics_db):
    # Compare conversion of sessions with errors vs without
    result = analytics_db.query("""
        WITH session_errors AS (
            SELECT
                session_id,
                COUNT(*) as error_count,
                MAX(CASE WHEN event_name = 'purchase' THEN 1 ELSE 0 END) as converted
            FROM events
            WHERE date >= CURRENT_DATE - INTERVAL '7 days'
            AND event_name IN ('js_error', 'purchase')
            GROUP BY session_id
        ),
        all_sessions AS (
            SELECT session_id,
                   MAX(CASE WHEN event_name = 'purchase' THEN 1 ELSE 0 END) as converted
            FROM events
            WHERE date >= CURRENT_DATE - INTERVAL '7 days'
            GROUP BY session_id
        )
        SELECT
            'with_errors' AS segment,
            COUNT(*) AS sessions,
            SUM(converted) AS conversions,
            ROUND(AVG(converted::float) * 100, 2) AS cvr
        FROM session_errors WHERE error_count > 0

        UNION ALL

        SELECT
            'without_errors',
            COUNT(*),
            SUM(a.converted),
            ROUND(AVG(a.converted::float) * 100, 2)
        FROM all_sessions a
        LEFT JOIN session_errors se ON a.session_id = se.session_id
        WHERE se.session_id IS NULL
    """)
    return result

# Typical result:
# with_errors:    1.2% CVR
# without_errors: 3.8% CVR
# Errors reduce conversion by 3+ times
Segment Sessions Conversions CVR
With errors 12450 149 1.2%
Without errors 112050 4258 3.8%

Difference — 3.2x. If your average order value is $100, weekly losses exceed $12,000.

Monitoring Tools Comparison

Tool Source maps Replay GA4 Integration Price
Sentry Yes Yes Via API Free up to 5k events/month
Bugsnag Yes No Via API From $29/month
LogRocket Yes Yes No From $39/month
GA4 No No Built-in Free

Sentry is the optimal choice for deep analysis: it combines source maps, Replay, and flexible GA4 integration. Compared to GA4, Sentry is better suited for debugging because it provides a full stack and Replay, reducing time to find the root cause by 5–10 times.

How to Prioritize Error Fixing?

We use the metric affected_users × conversion_impact. Errors in checkout/payment modules get weight 3, others 1. Example:

def prioritize_errors(sentry_api, project_slug):
    """Priority = affected_users × conversion_impact"""
    issues = sentry_api.get_issues(project_slug, limit=50)

    for issue in issues:
        affected_users = issue['userCount']
        # Errors in checkout/payment — high priority
        is_critical = any(p in issue['culprit'] for p in
                         ['checkout', 'payment', 'cart', 'form'])
        issue['priority_score'] = affected_users * (3 if is_critical else 1)

    return sorted(issues, key=lambda x: x['priority_score'], reverse=True)

Typical Critical Errors

  • Cannot read property 'X' of undefined — race condition during async loading
  • Network Error in fetch — API unavailable, no retry logic
  • PaymentRequestUpdateEvent — Payment Request API errors on iOS Safari
  • ChunkLoadError — outdated cache after deployment (solution: window.location.reload())
Case study: how we improved CVR by 25%

In one project (an electronics e-commerce store), after deploying a new version of the checkout module, conversion dropped from 3.5% to 1.1%. It turned out that 40% of sessions had an error Cannot read property 'price' of undefined due to a changed API response format. Sentry showed that the error affected 15k users per day. After the fix and redeployment, CVR returned to 3.5% within 2 days. Losses over 3 days amounted to ~900 orders.

What's Included in the Service

  • Setting up interception of all JS errors (including source maps)
  • Integration of Sentry with Replay and Tracing
  • Creating events in GA4 for conversion analysis
  • Dashboards for error impact on CVR and revenue
  • Prioritized list of bugs with recommendations
  • Integration documentation and dashboard access
  • One month of support after implementation

Work Process

  1. Audit of current monitoring: check which errors are already being intercepted.
  2. Tool setup: install Sentry, refine GA4 events.
  3. Data collection: 7 days of accumulating Error Sessions statistics.
  4. Analysis and prioritization: build SQL reports, calculate conversion impact.
  5. Report and fixes: provide you with a list of bugs indicating criticality, assist with corrections.
  6. Verification: after fixes, repeat analysis to ensure CVR growth.

Timelines and Results

First results within 2 business days: you see a dashboard with Error Sessions and their impact. Full analysis and prioritization cycle takes 5 to 7 days. Specific cost depends on project scope (number of pages, integrations), so we calculate it individually. Contact us — we'll evaluate your project for free.

Why Choose Us

Our experience: over 10 years in frontend development and monitoring. We've worked on projects where CVR increased by 25% solely by eliminating JS errors. We use only proven tools: Sentry, GA4, Grafana. We guarantee correct integration operation. Order an audit — get a consultation with a detailed breakdown of your Error Sessions. Contact us — we'll prepare a custom proposal.

Setup Web Analytics: GA4, GTM, Yandex.Metrica, and Amplitude

We often see: conversion rate 1.2%, traffic grows, but conversion stays flat. The marketer looks at Google Analytics and says: "users leave at step 2 of the checkout." The developer opens the same step — no errors, Sentry is silent. So it's not a JS bug, but a UX issue or skewed data from analytics. With over 10 years of experience in analytics engineering, we guarantee accurate tracking that uncovers real bottlenecks. Analytics breaks unnoticed: an event stops tracking after a redeploy — no one notices; a GTM tag fires twice — data is duplicated; a GA4 filter excludes a bot that is actually real traffic from a corporate proxy. An audit of your current tags will find the cause within a week.

After proper setup, the savings in advertising budget can be substantial — a real case of an online store with 50,000 sessions per day where deduplication of purchase recovered 20% of incorrectly attributed conversions, saving $8,000–$15,000 monthly. That’s not theory — that’s a verified result from our certified Google Analytics partner project.

Why do GA4 events duplicate and how to fix it?

Universal Analytics is gone, replaced by GA4's event-based model. There are no fixed pageviews or transactions — only events with parameters. This is more flexible but requires proper event design. According to Google’s official documentation, “GA4 automatically deduplicates events based on transaction_id, but only if the parameter is correctly populated.” Many implementations miss this.

Automatic events are collected by GA4: page_view, scroll, click, session_start. Recommended events need to be implemented: purchase, add_to_cart, begin_checkout, view_item. Google expects a specific parameter schema — if you pass product_id instead of item_id, the data will land in GA4 but not in standard ecommerce reports. Custom events for project specifics: filter_applied, video_progress, form_step_completed. Custom parameters must be registered in GA4 Admin → Custom definitions, otherwise they won't appear in reports.

A common mistake is the purchase event being duplicated. Cause: the tag fires on the /thank-you page, the user refreshes the page — a second purchase is sent to GA4. Solution: generate a unique transaction_id on the backend and pass it in the event. In our experience, 80% of e-commerce stores have this issue. GA4 deduplicates based on it (in theory — verify with DebugView). Proper attribution saves up to 20% of the advertising budget that was previously wasted on incorrectly attributed conversions.

How to set up the data layer to avoid data loss?

GTM is a tool for managing tags without code deployment. But "no code" doesn't mean "no architecture." The data layer is the foundation. We pass data from the application to GTM via dataLayer.push(). Structure: event + contextual data. For e-commerce: before opening a product page — push with product data. GTM tag reads from the data layer, not from the DOM.

window.dataLayer = window.dataLayer || [];
dataLayer.push({
  event: 'view_item',
  ecommerce: {
    items: [{
      item_id: 'SKU-12345',
      item_name: 'Product name',
      price: 1990.00,
      currency: 'USD'
    }]
  }
});

Bad practice: GTM tag parses the DOM — looks for the price in span.price, the name in h1. This breaks with any layout change. Good practice: always use the data layer. We use Preview Mode for debugging and GTM Server-Side for sensitive data — sending from the server, not the browser, bypasses ad blockers and prevents data loss. A properly implemented data layer reduces tracking errors by 95%.

How does Yandex.Metrica complement web analytics?

For a Russian audience, Metrica is a must — especially Webvisor. Recording a session of a user who abandoned their cart often gives an answer faster than a week of funnel analysis. Goals in Metrica: event-based (via ym(COUNTER_ID, 'reachGoal', 'GOAL_NAME')) or automatic (button click, page visit). Integration with CRM via Metrica Plus — passing offline conversions. Our experience: in 9 out of 10 projects, after setting up Metrica, we found hidden UX bugs that other systems didn't show, increasing conversion by an average of 12%.

What does product analytics give in Amplitude?

Amplitude is a product tool, unlike marketing-oriented GA4 and Metrica. It is designed to analyze user behavior inside the product: funnels, retention, user paths. Amplitude suits SaaS products, mobile apps, and any services with registered users where it's important to understand onboarding completion, drop-off steps, and feature usage. Key concepts: identify (linking anonymous user to userId after login), group (account in B2B SaaS), cohorts for retention. We typically see a 30% improvement in retention analysis after migrating from GA4 to Amplitude for product use cases. Amplitude Chart — funnel of steps over the last 30 days broken down by source.

Monitoring Data Quality

Analytics without monitoring is a black box. We set up:

  • GA4 Realtime — check after every deploy that key events are coming in
  • Alerting in GA4 — anomaly in the number of purchase events (sharp drop = something broke)
  • GTM Preview in staging before production
  • Manual funnel tests once a week — simply go through the buyer journey and verify everything is tracked
What we check after each deploy
  • All recommended events present in DebugView
  • No duplicates (count purchase per 100 sessions)
  • Data layer structure unchanged after frontend update

What the work includes

Component Description
Audit of existing tags Check current GTM tags, data layer, duplicates, and errors
Event schema design Documentation: event list, parameters, triggers
GA4 + GTM setup Create configuration, tags, custom definitions
Yandex.Metrica Install counter, create goals, set up Webvisor
Amplitude (optional) Set up client and server SDK, cohorts
QA and monitoring Testing in Preview Mode, alerting
Training and handover Access, instructions for adding new events, console

Process and timeline

  1. Audit of existing tags and data (2 days)
  2. Event schema design (2 days)
  3. Data layer development and tag setup (3–5 days)
  4. QA in Preview Mode and staging (2 days)
  5. Deploy and dashboard setup (1 day)
Scenario Timeline
Basic GA4 + GTM setup 1 week
Full e-commerce tracking + Metrica 2–3 weeks
Server-side GTM + Amplitude 3–5 weeks

Cost is calculated individually. Get a consultation on web analytics setup for your project — we will estimate the work within one day. Contact us to get started with a free audit of your current tracking.