Stop simulation time while the document is hidden
Analysis
By UA Ledger staff — 3 min read

Stop simulation time while the document is hidden. A runnable teaching fixture with synthetic cases, a broken branch, and explicit untested cells.
Returning to a playable should not reveal that the timer expired while the player could not see it. This fixture tests an explicit visibility gate around simulation time.
This edition is a laboratory fixture. Node and the companion HTML page execute the authored functions against synthetic cases. No physical device panel was run, no ad network reviewed the build, and no campaign result is inferred from a passing test.
What the documentation actually supplies
MDN: visibility pause is the governing reference for the browser primitive. MDN documents document.visibilityState as a way to determine whether a document is visible or hidden, including background-tab and minimised-window cases. It is a document state, not a complete advertising-viewability measurement. The fixture policy around that primitive is ours.
The failure the fixture isolates
The input is a sequence of elapsed intervals labelled visible or hidden. The corrected branch advances the model only for visible intervals; the broken branch adds every interval. A long hidden period makes the error obvious without waiting for an actual browser tab to remain in the background.
The broken branch is retained so a producer can see the exact mistake, not only the repaired output.
| Case | Input | Expected (fixed) | Broken output |
|---|---|---|---|
| hidden interval excluded | `[{"visible":true,"ms":16},{"visible":false,"ms":5000},{"visible":true,"ms":16}]` | `32` | `5032` |
| fully hidden | `[{"visible":false,"ms":9000}]` | `0` | `9000` |
| fully visible | `[{"visible":true,"ms":20}]` | `20` | `20` |
All 3 fixed-branch cases matched the spec when executed in Node on 19 September 2026.
What a pass does not prove
This is a deterministic simulation-clock test. It does not verify host SDK callbacks or whether all effects and sounds pause together. A real build can have multiple clocks, and pausing only the main game loop while a separate timeout advances the end card still produces inconsistent behaviour.
Untested cells in this edition: physical devices, host SDKs, network packaging limits, store-opening callbacks, and campaign performance. Those remain empty on purpose.
Next check on a real build
List all timers that can change the player's state, then decide which should pause and which represent real-world deadlines. On return to visibility, reset the frame timestamp so the hidden interval is not applied as one enormous step. Verify the behaviour in the actual host before calling it a viewability integration.
Open the runnable fixture to re-execute the cases in a browser. Download the case record to keep inputs, expectations and limits with a QA ticket.
Background in the archive: Playable ad device testing matrix and Playable spec sheet before you build. Those guides describe practice; they are not a substitute for this fixture and this check does not recertify their every claim.
Featured
Related posts
measurement
playable ads
·1 min read
Playable completers vs video viewers: downstream payer quality
measurement
playable ads
·3 min read
Fit the whole playable stage inside a narrow viewport
measurement
playable ads
·2 min read
Require both intersection and document visibility before advancing
measurement
playable ads
·2 min read
Keep a preference usable when persistent storage fails
More from the Measurement desk
measurement
·2 min read
Airbridge adds Amazon Ads as an app measurement channel
measurement
·2 min read
When to freeze a cohort for payback review (and when not to)
measurement
media buying
·1 min read
Using predicted LTV in bids: disclosure checklist for the UA team
measurement
media buying
·1 min read