@99devco/analytics - v3.1.0
    Preparing search index...

    Function getPCount

    • Derives the visitor's page-count for the current browsing context. The count is primarily read from sessionStorage, with localStorage used as a fallback to handle new tabs or browser restarts. Several heuristics are applied:

      • Fresh external entry (no stored count, referrer is empty or absolute URL) resets the counter to 1.
      • Opening an internal link in a new tab reuses the localStorage value.
      • When another tab has progressed further, its higher localStorage value becomes the baseline to keep counts monotonic.

      Parameters

      • referrer: string

        The raw referrer path/URL to help detect external entries

      • skipIncrement: boolean = false

        When true, returns the existing count without adding one

      Returns number

      The next page-count that should be associated with the view/event

      const pcount = getPCount(document.referrer);