Back to the archive
Performance

Which Script Delayed the Cart? Long Animation Frames for Ecommerce

Use long animation frame evidence to investigate slow filters, variant selectors, and cart drawers, with a practical performance scorecard.

An ecommerce operator reviewing performance metrics on a laptop.

A cart drawer can feel frozen even when the product page loads quickly. The customer taps Add to cart, the browser runs several pieces of JavaScript, layout changes accumulate, and the visible confirmation arrives late. A page-load score cannot explain which part of that interaction consumed the time. Merchants need evidence that connects the action to the code and rendering work around it.

Our editorial approach is to begin with one reproducible customer action and work backward from its delayed feedback. Long Animation Frames, commonly shortened to LoAF, can help with that investigation. This guide builds an ecommerce diagnostic workflow around the API, including the limits of its coverage. The examples are illustrative engineering exercises, not measured results from a merchant or universal performance benchmarks.

Developers collaborating on a storefront performance investigation

Table of Contents

Understand what a frame tells you

The Chrome Long Animation Frames documentation describes frames whose rendering update is delayed beyond 50 milliseconds. Unlike examining individual long tasks alone, a frame view can reveal several pieces of work that accumulate before an update. This matters when a cart interaction triggers theme code, a recommendation component, and a layout recalculation in close succession.

LoAF is diagnostic evidence, not a replacement name for Interaction to Next Paint. INP describes responsiveness experienced during eligible interactions; a long frame may occur without a shopper interaction. The W3C specification defines timing and attribution fields that can help investigate that work. Do not report a frame duration as if it were an INP measurement, and do not assume every frame caused a lost sale.

There is also a coverage boundary. Chrome documents support beginning with Chrome 123, but that does not imply the API exists in every browser your customers use. Detect support at runtime. Maintain the broader responsiveness report and use LoAF as an additional diagnostic layer wherever it is available.

Define the interaction before collecting data

Choose a customer task with a clear start and visible end. Good candidates include applying a collection filter, selecting a variant, opening the cart drawer, and expanding a product comparison. Record the template, release identifier, broad device category, and a stable action label. A label such as cart-open is more useful for aggregation than a raw selector generated differently on every deployment.

Separate immediate feedback from completion of the business operation. A button can respond quickly while the inventory request is still pending. Conversely, a cart request can finish successfully while rendering its drawer remains expensive. Track those phases separately so the team does not optimize the wrong system. The acceptable feedback should also communicate what is happening without implying that an order or reservation already exists.

Collect only information required for diagnosis. Avoid customer names, search text, cart contents, and full URLs containing query parameters. Map script addresses to approved asset families before storage where possible. Sampling and payload limits belong in the design: sending a large diagnostic event after every action can itself consume network and processing resources.

Start in a controlled session. Confirm the collector distinguishes supported browsers, unsupported browsers, disabled collection, and transport failures. Only then introduce a bounded field sample. An empty dashboard is ambiguous until you know whether it means no slow frames or no usable observations.

Build a diagnostic scorecard

Use the following table as a reporting contract. Its formulas are proposed local definitions; they are not official browser metrics or industry targets. Keep the raw counts beside percentages so a small sample does not acquire false authority.

MeasureSuggested definitionWhat it helps decide
API coveragesupported observed page views / observed page viewswhere diagnostic evidence applies
Collection successreceived diagnostic sessions / selected eligible sessionswhether sampling works
Slow-action exposureobserved actions associated with a qualifying frame / observed actionswhich task deserves investigation
Attributed-frame shareframes with usable approved script attribution / collected frameshow much evidence identifies code
Repeat-action differencelater-action timing compared with first-action timingwhether repeated use changes behavior
Completion guardrailsuccessful task completions / attempted taskswhether the repair preserves function

Define the association window explicitly. A frame that overlaps an interaction is a candidate explanation, not automatic proof of causality. If one frame spans several events, preserve that ambiguity rather than assigning its full cost to every event and summing the results.

For broader reporting, connect this scorecard to the real-user monitoring guide. That guide covers distributions and segments. The present workflow answers the next question: which observable work should an engineer reproduce first?

Work through a slow cart example

Imagine a test in which an Add to cart action produces a delayed drawer. The following numbers describe an invented trace, not a production benchmark. They identify investigative directions; a real trace is needed to confirm task boundaries and overlapping work.

ObservationIllustrative evidenceNext investigation
Theme callback90 milliseconds of script executioninspect cart rendering and repeated listeners
Recommendation callback65 milliseconds of script executioncheck whether it must run before feedback
Style and layout work35 milliseconds around the updateinspect layout reads and DOM changes
Cart requestresponse received before the delayed paintinvestigate rendering before blaming network
Second drawer openingslower than the firstcheck repeated initialization and retained components

Do not add every timing field blindly. Some attribution values describe work within a larger interval. Summing parent and child measurements overstates the delay. Likewise, total frame duration and blocking duration answer different questions; use their documented definitions rather than inventing a single combined speed score.

The immediate hypothesis is that optional recommendations compete with essential cart feedback. Test a version that presents accurate cart state before preparing recommendations. If the drawer becomes responsive but recommendations never appear, the experiment has revealed a dependency bug rather than a finished optimization. Record both observations and repair the sequence.

Product team examining a performance investigation together

Turn attribution into a testable repair

Give an engineer the action, template, release, approximate device conditions, and a representative trace. A script appearing in attribution establishes a lead; it does not justify deleting an integration. The integration might perform essential pricing, accessibility, or inventory work. Inspect the call path and determine which work must finish before the next useful visual response.

Possible repairs include removing duplicate initialization, reducing unnecessary DOM replacement, postponing optional widgets, and separating layout measurements from mutations. Select the change from observed evidence. Avoid a blanket delay on all scripts, which can hide purchase controls or postpone useful feedback as easily as it postpones expensive work.

Reproduce the first interaction and repeated interactions. Test empty and populated carts, unavailable variants, slow requests, and recovery after failure. If delay grows with browsing depth, continue with the long-session memory guide, whose specific focus is deterioration over a session.

Compare releases without hiding missing data

Freeze the reporting definitions before comparing versions. Keep the action labels, sampling policy, device grouping, and qualifying-frame criteria stable. Report how much traffic each release contributed, and avoid treating a short quiet rollout as equivalent to a full promotional day.

Check successful cart updates, displayed quantities, keyboard focus, and error handling beside responsiveness. An interaction that paints quickly but loses the customer’s selection has failed the product requirement. Also inspect unsupported browsers through their available measurements and direct testing; improvement in the observed subset cannot establish universal improvement.

A useful release note states what changed, which actions improved in the measured population, what functional checks passed, and where evidence is still sparse. Conversion can be monitored as a guardrail, but a coincident increase does not demonstrate that the frame repair caused it. Promotions, traffic sources, inventory, and device mix remain alternative explanations.

Questions from ecommerce teams

Is LoAF another Core Web Vital? No. Use it to investigate responsiveness and rendering work; keep the customer-facing performance metrics in their own report.

Should every long frame become a ticket? No. Prioritize repeatable issues on useful customer actions, with enough observations to establish that the problem recurs.

Can attribution identify every third-party cause? Do not assume complete visibility. Preserve an unknown group and inspect representative traces when attribution is incomplete.

Can a merchant start without custom collection? Yes. Begin with an observed slow action and browser tooling, then add field diagnostics when there is a clear question that local reproduction cannot answer.

EcomToolkit point of view

The useful outcome is a specific repair that makes a shopping task respond correctly and promptly. Frame counts are supporting evidence. Begin with the customer action, investigate the work, and validate the repaired experience. If your team needs help turning that evidence into priorities, request an ecommerce audit.

Related partner guides, playbooks, and templates.

Related ecommerce guides.

Free Shopify Audit

Get a free Shopify audit focused on the fixes that can move revenue.

Share the store URL, the blockers, and what needs attention most. EcomToolkit will review UX, CRO, merchandising, speed, and retention opportunities before replying.

What you get

A senior review with the priority issues most likely to improve performance.

Best for

Brands planning a redesign, migration, CRO sprint, or retention cleanup.

Reply route

Every request is routed to info@ecomtoolkit.net.

We use these details to review your store and reply with the next best steps.