Skip to content

clampScrollDepth

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/apps/api/src/analytics/utils/tracking-utils.ts

Clamp scroll depth into the 0–100 range. Some browsers occasionally report 101% on bounce or with sticky footers; clamp instead of dropping the row.

Signature

ts
function clampScrollDepth(depth: number | null | undefined): number | null

Parameters

NameType
depth`number

Returns: number | null

Was this page helpful?

Download as PDF