Blog

    Enabling HIPAA-Compliant Digital Usage Analytics: Server-Side Collection, Scrubbing and Events Never to Send

    By GauravJuly 16, 20269 mins read
    On this page

    Product teams in healthcare want the same answers as any other team: where users drop out of sign-up, which features get used, whether a redesign helped. The usual way to get them, a third-party script on every page, sends URLs, IP addresses and device details to a vendor that may hold no agreement with you.

    This post is for product, engineering and privacy leads at health app companies. It sets out an analytics setup without PHI: server-side collection, a scrubbing step, self-hosted or BAA-covered tools, analytics IDs, and the events a health app should never send.

    How do you enable HIPAA-compliant digital usage analytics?

    Need analytics without the PHI risk?

    Our healthcare data analytics team builds event pipelines and dashboards that answer product questions safely.

    HIPAA-compliant digital usage analytics means collecting product events through your own server, scrubbing them against an approved list, storing them in a self-hosted or BAA-covered tool, and never sending health details at all. Agnotic Technologies builds these analytics pipelines for health apps and patient portals.

    The aim is to answer product questions with the least data. Most product questions need counts and funnels, not identities.

    Why do client-side analytics tags leak PHI?

    Client-side tags leak PHI because they send whatever the browser knows to the vendor directly: the full URL, page title, IP address, device details and any custom properties. On a patient portal, the URL or title alone can reveal a condition or an appointment type.

    HIPAA's safe harbor de-identification method lists device identifiers and serial numbers, web URLs and IP addresses among the identifiers that must be removed, alongside names and geographic subdivisions smaller than a state.

    Those are exactly the fields a client-side tag sends by default. Combined with a page about a specific service, they tie a person to a health interaction, which is why a tag that is harmless on a marketing site can be a disclosure inside a portal.

    Mobile SDKs behave the same way. They often collect device identifiers and advertising IDs automatically, so each app build needs the same review as the web pages.

    Server-side event collection

    Server-side event collection sends events from the app to a collector on your own domain, which passes them on only after checks. Third-party scripts stay off authenticated pages entirely.

    Server-side product analytics for a health app: the web or mobile app sends minimal events to a first-party collector on the app's own domain, a scrubbing step applies an allowlist schema, normalizes URLs and drops IP addresses, then events land in a self-hosted or BAA-covered analytics store, and product teams read dashboards with counts and funnels, with a tracking plan bar beneath

    The collector is a small service you own. It can tell signed-in sessions from anonymous ones, rate-limit abuse and apply the same scrub to web and mobile events, so one set of rules covers every client.

    Keep the collector's own logs as lean as the events. A collector that logs raw requests before the scrub recreates the leak in a different place.

    What should the scrubbing step remove?

    The scrubbing step should pass only fields named in the tracking plan and drop everything else. Allowlists hold up better than denylists, because a new field added by a developer is blocked until someone approves it.

    • URLs: replace paths with route patterns and remove query strings and fragments.
    • Network data: drop the IP address before storage, and keep only coarse location if any.
    • Device details: keep platform and app version, drop device IDs and detailed user agents.
    • Free text: never forward search terms, form values or error messages.

    Log what the scrub drops, by field name only. A spike in dropped fields usually means a client release started sending something new.

    How should analytics user IDs be built?

    Analytics user IDs should be random values with no link to the patient's identity, stored in a lookup only your own systems can use. Hashing an email address or record number is not enough, because anyone holding the same input can produce the same hash.

    Under 45 CFR 164.514(c), a covered entity may give de-identified data a re-identification code only if the code is not derived from or related to information about the individual, and the covered entity does not disclose how to re-identify it.

    That rule is written for de-identified data sets, and it is a sound design rule for analytics IDs too. Generate the ID at random, keep the mapping inside your platform, and never send the mapping to the analytics tool.

    Should analytics tools be self-hosted or BAA-covered?

    Either can work: self-hosted tools keep events in your infrastructure, while a vendor that signs a business associate agreement can hold them under contract. A vendor that will not sign should receive only data that is free of PHI.

    HIPAA defines a business associate as a vendor that creates, receives, maintains or transmits protected health information for a covered entity, so a cloud service that maintains ePHI falls inside the definition.

    • Self-hosted: full control and no outside recipient, but you run upgrades, scaling and security.
    • BAA-covered vendor: less operational work, with the agreement, access controls and retention to review.
    • Neither: only for events that carry no identifiers and no health context, such as public site traffic.

    Whichever you choose, the scrub stays. A BAA covers the vendor's duties; it does not make sending unneeded data a good idea.

    Which events should a health app never send?

    A health app should never send events whose name, properties or context reveal a condition, treatment, result or appointment type. Track the action, not the content.

    • Condition-named events: viewed_diabetes_plan instead of plan_viewed.
    • Result content: values, flags or test names attached to a results_viewed event.
    • Search terms: what a patient typed into symptom or provider search.
    • Message content: anything from secure messages, including subject lines.
    • Booking detail: specialty, provider or visit reason attached to an appointment event.

    Ask of each event whether a stranger reading it could learn something about someone's health. If the answer is yes, change the event or drop it.

    The tracking plan

    A tracking plan lists every event and property with its purpose, owner and the question it answers. The scrub reads from the same plan, so an event that is not on the plan never reaches the store.

    Review new events like code. A privacy reviewer approves each addition, and the plan's history shows who added what and why.

    Keep retention in the plan too. Events that answer this quarter's questions rarely need keeping for years, and shorter retention limits what any later incident can expose.

    What goes wrong with health app analytics?

    Most problems come from defaults nobody turned off and events nobody reviewed.

    • Tags on portal pages: marketing scripts copied onto authenticated screens.
    • Hashed identifiers: an email hash used as the analytics user ID.
    • Auto-capture: SDKs that record every click and form field by default.
    • Route names: screen names that include a specialty or condition.
    • Unreviewed events: properties added in a hurry before a launch.

    A worked example: a patient portal moves server-side

    A health system's patient portal uses a third-party tag on every page. A privacy review finds that result pages send full URLs with test names in the path.

    The team removes the tag from authenticated pages and adds a first-party collector. The portal now sends events such as results_viewed and message_sent, with route patterns and random analytics IDs, to a self-hosted analytics store.

    The product team still sees its funnels: sign-up completion, first message sent and results opened. It no longer sees test names, URLs or IP addresses, and the privacy officer signs off on the tracking plan.

    The review also finds two older events with condition names in them. They are renamed to action names, and historic data under the old names is deleted from the vendor.

    Who owns the tracking plan, scrub and event approvals?

    Analytics crosses product, engineering and privacy, so the roles need writing down.

    • Product lead: the questions, the tracking plan and the dashboards that answer them.
    • Engineering lead: the collector, the scrub, client instrumentation and tests.
    • Privacy officer: approval of new events, vendor agreements and periodic reviews.
    • Marketing lead: keeping marketing tags off authenticated pages and app screens.

    Give the privacy officer read access to the plan and the scrub's drop log. Reviews go faster when they can see what is collected without asking engineering.

    How do you test the analytics pipeline?

    Test by sending events with marker values in every field and checking what reaches the store. Anything that arrives beyond the plan's fields is a gap in the scrub.

    • Field test: send an event with an unplanned property and confirm it is dropped.
    • URL test: visit a page with a query string and confirm only the route pattern is stored.
    • Tag audit: scan authenticated pages and app builds for third-party scripts and SDKs.
    • ID test: confirm analytics IDs cannot be matched back to emails or record numbers outside your platform.

    Run the tag audit on every release. Third-party scripts arrive through tag managers and plugins, often without a code change anyone reviewed. Include mobile builds in the audit, listing every SDK compiled into the app and what it collects by default.

    What are HIPAA-compliant analytics best practices?

    Collect events server-side on your own domain, scrub them against an allowlist tracking plan, and keep third-party tags off authenticated pages. Use random analytics IDs and store events in a self-hosted or BAA-covered tool.

    Track actions rather than health content, review every new event, and test the scrub and the pages on each release.

    How can Agnotic help build PHI-free usage analytics?

    Agnotic builds analytics for health apps and portals that keep PHI out: first-party collectors, allowlist scrubs, tracking plans, random analytics IDs, self-hosted or BAA-covered stores, and the tests and tag audits that keep them clean. Your product team gets its funnels, and your privacy officer gets a pipeline they can review.

    Build privacy-safe analytics with Agnotic

    We build health apps and their analytics pipelines with PHI controls designed in.

    Sources

    Frequently Asked Questions

    Not on authenticated pages or screens with health content, unless the vendor signs a business associate agreement and the data is limited. Server-side collection with a scrub is safer.

    Talk to an engineer about your project

    Tell us about your app, current analytics tools and questions. We will design the collector, scrub and tracking plan to answer them safely.