piidetectionapi.com
Home
Solutions - Fundamentals
What Is PII Detection? NER vs Regex vs Rules Accuracy, Precision & Recall PII in Test Data
Solutions - Compliance
GDPR Personal Data HIPAA PHI Detection CCPA / CPRA PCI DSS Card Data
Solutions - AI & LLM Safety
LLM Guardrails Chatbot PII Filtering RAG Pipelines
Solutions - Data Discovery & DLP
Data Loss Prevention Log File Scanning Support Tickets Email Scanning Documents & PDFs Database Discovery ETL & Streaming Pipelines
Industries - Financial
Banking Fintech Insurance
Industries - Healthcare
Healthcare Pharma & Clinical Trials Telehealth
Industries - Public Sector & Legal
Government & FOIA Law Enforcement Law Firms & eDiscovery Education (FERPA)
Industries - Technology
SaaS Platforms Cybersecurity & IR Telecommunications Gaming & Platforms
Industries - Other
HR & Recruiting Retail & E-commerce Call Centers & BPO Real Estate Travel & Hospitality Marketing & AdTech
How-to Guides - Identity & Contact
Detect Names Detect Email Addresses Detect Phone Numbers Detect Physical Addresses Detect Dates of Birth
How-to Guides - IDs & Financial
Detect SSNs Detect Passport Numbers Detect Drivers Licenses Detect Credit Card Numbers Detect Bank Accounts & IBAN
How-to Guides - Technical & Health
Detect IP & Device IDs Detect Medical Records & PHI
Resources
Pricing API Docs Supported Entities Languages About Contact Sign In Try the Live Demo Get Started
Marketing & AdTech Solutions

PII Detection for Marketing & AdTech

Ad platforms ban PII. Privacy laws restrict it. Your analytics, URLs, CRM notes, and survey responses are full of it anyway. Detect personal data across the martech stack — and hash identifiers so measurement keeps working without exposure.

GA4-safe analytics CRM data hygiene Clean rooms CCPA/CPRA & GDPR 150+ entity types

Marketing Runs on Personal Data It Isn't Allowed to Spill

Marketing sits in a strange squeeze. The discipline exists to know customers — names, emails, behaviors, preferences — yet nearly every platform it depends on prohibits receiving that knowledge in raw form. Google Analytics' terms forbid sending data that could identify an individual, and Google can delete properties found collecting it. Ad platforms restrict PII in conversion pings and audience files except through designated hashed-upload paths. Privacy laws add the legal layer: consent, purpose limits, and opt-outs governing what may be collected and shared at all.

The violations are rarely deliberate. An email address rides into GA4 inside a query string after a form submit. A newsletter click carries the subscriber's address in a UTM parameter to every analytics and retargeting pixel on the landing page. A sales rep pastes a prospect's mobile number and divorce anecdote into a CRM free-text field that later feeds a lookalike-audience export. Survey "tell us more" boxes fill with names, phone numbers, and health details that flow straight into dashboards and LLM-powered summary tools. Each leak is small; at martech volume they are systemic.

Our PII Detection API gives marketing engineering a way to catch them all with one integration: send any text — an event payload, a URL, a survey response, a CRM note — and get back every detected entity with type, exact offsets, and confidence, plus a masked or hashed copy. It is the inspection layer between your data collection and every platform you are not allowed to leak into.

"No PII in analytics" is a detection problem, not a policy problem

Every martech team already has the policy. What they lack is the mechanism that notices when a developer's form handler starts appending ?email= to redirect URLs. Content-level scanning of event payloads and URLs is that mechanism — it inspects what is actually flowing, not what the tagging plan says should flow. Browse the entity catalog and the API documentation for the full contract.

The Rules Boxing In Modern Marketing Data

Platform policies and privacy statutes converge on the same requirement: know exactly where personal data is before you collect, share, or sell it

Analytics & Ad Platform Policies

GA4's terms prohibit sending Google identifiable information — emails, names, precise locations — in events, page URLs, or user properties; violations risk property deletion and data loss. Ad networks apply similar rules to conversion APIs and audience uploads, permitting identifiers only through prescribed hashed channels. Automated scanning of payloads and URLs before they reach the tag layer is the control that makes those promises true.

CCPA/CPRA: Sharing Is Selling

CPRA's definitions of "sell" and "share" reach routine adtech flows — passing personal information to ad platforms for cross-context behavioral advertising triggers opt-out rights, "Do Not Sell or Share" links, and contractual duties to downstream recipients. Enforcement has already targeted retailers whose tags kept firing after opt-outs. Knowing precisely which identifiers each tag transmits is step zero; see the CCPA/CPRA detection guide.

GDPR & ePrivacy Consent

For EU audiences, marketing data needs a lawful basis, honored consent states, and data-subject rights that reach every CRM note and campaign export. GDPR's definition of personal data is broad — online identifiers and hashed emails still qualify — so pseudonymization reduces risk rather than removing obligations. Detection supports the practical duties: locating a person's data for access or erasure across the stack. Start with the GDPR guide.

Email & Messaging Rules

CAN-SPAM, CASL, and TCPA govern how lists are built and used; suppression lists must be honored forever, and consent records must map to actual addresses and numbers. List hygiene is where it gets operational: purchased or imported lists arrive with stray PII in the wrong columns, and free-text unsubscribe feedback contains identifiers that never belonged in the tool. Our email scanning guide covers the patterns.

CRM Hygiene: The Free-Text Fields Nobody Audits

Structured CRM fields are governed by schema and permissions; the notes field is governed by habit. Reps record whatever helps them sell: personal cell numbers, spouses' names, health situations explaining a delayed deal, even payment details taken over the phone. Those notes then travel — into enrichment syncs, warehouse copies, audience exports, sales-coaching AI tools — carrying category-of-data obligations the CRM's field-level controls never see.

A scheduled detection sweep over notes, activity logs, and custom text fields produces a per-record inventory of what actually lives there: which records hold PHONE_NUMBER beyond the structured field, where CREDIT_CARD_NUMBER or MEDICAL_DATA appears, which segments are safe to export. Findings can be masked in place, or routed for review where sales context must be preserved. The same index answers deletion requests completely — including the mentions hiding outside the contact record — a workflow our database discovery guide develops in detail.

Where PII Hides Across the Martech Stack

A data map of the systems marketing runs, the identifiers that leak into them, and the entity filters to scan them with

EMAIL_ADDRESS
URLs, events, survey text
PERSON_NAME
CRM notes, reviews, feedback
PHONE_NUMBER
Notes, SMS lists, call logs
ADDRESS / ZIP_CODE
Shipping data in events
URL / COOKIE
Query strings, click IDs
IP_ADDRESS / DEVICE_ID
Server-side event streams
CREDIT_CARD_NUMBER
Phone-order notes, chat
DATE_OF_BIRTH / AGE
Loyalty & survey data
MEDICAL_DATA
Sensitive-segment risk
ETHNIC_GROUP / RELIGION
Prohibited targeting signals
GPS_COORDINATES
Location-based campaigns
EMPLOYMENT
B2B enrichment records
Martech System PII That Leaks In Rule It Breaks Recommended Entity Filter
Web analytics (GA4, product analytics) Emails and names in page URLs, search terms, form-field echoes in events GA4 no-PII terms, GDPR lawful basis EMAIL_ADDRESS, PERSON_NAME, PHONE_NUMBER, ADDRESS
Campaign URLs & UTM parameters Subscriber emails in click-through links, IDs that resolve to individuals Platform PII bans, referrer leakage to third parties EMAIL_ADDRESS, PHONE_NUMBER, PERSON_NAME, ZIP_CODE
CRM free-text fields Personal cells, family details, card numbers, health context in notes GDPR minimization, CPRA sensitive-data rules, PCI DSS PHONE_NUMBER, CREDIT_CARD_NUMBER, MEDICAL_DATA, PERSON_NAME, DATE_OF_BIRTH
Surveys, reviews & feedback Self-disclosed contact info, order details, third-party names in free text Consent scope, publication risk, vendor DPAs PERSON_NAME, EMAIL_ADDRESS, PHONE_NUMBER, ADDRESS, MEDICAL_DATA
Audience exports & clean rooms Raw identifiers in files meant to be hashed, stray columns in CSVs Platform hashed-upload specs, clean-room ingress rules EMAIL_ADDRESS, PHONE_NUMBER, PERSON_NAME with mask_mode: "hash"
Marketing data warehouse Everything above, replicated and joined — the accumulation point GDPR storage limits, CPRA purpose limits, breach scope All entities (default) with threshold: 0.6

The URL Is Your Leakiest Data Pipe

Query strings are where marketing PII escapes containment. A form handler redirects to /[email protected]; an ESP template personalizes links with the subscriber's address; a support flow embeds a phone number "for convenience." From that moment the identifier propagates everywhere URLs go: the analytics pageview, every marketing pixel on the page, referrer headers sent to third-party embeds, server access logs, and the browser histories of shared machines. GA4's own documentation names URL query parameters as the classic accidental-PII channel — and remediation after the fact means purging data you were never allowed to hold from systems you do not control.

Detection closes the pipe at two points. In the collection path, a server-side tagging step or collection proxy scans the page_location and event parameters of each hit, rewriting email=[EMAIL_ADDRESS] before the payload leaves for any vendor. In audit mode, a scheduled job replays recent URLs and event payloads from your analytics export through the API and reports which parameters, pages, and tags are leaking — turning an invisible compliance debt into a ranked fix list for the web team. The same audit doubles as evidence of "appropriate technical measures" when the privacy office asks. For log-side coverage of the same URLs, see scanning application logs for PII.

Marketing & AdTech Use Cases

Six places marketing and data teams wire in detection first

1

Analytics Payload Gatekeeping

Scan event payloads and page URLs in the server-side tagging layer before they fan out to GA4 and ad pixels. Identifiers are masked in flight, so no vendor ever receives what their terms prohibit — and your measurement property stops accumulating deletion risk.

Input
page_location=/[email protected]&fname=Jane&utm_campaign=spring
Detected & Masked
page_location=/thanks?email=[EMAIL_ADDRESS]&fname=[PERSON_NAME]&utm_campaign=spring
2

Survey & Review Scrubbing

Free-text responses go to dashboards, all-hands decks, and AI summarizers — audiences the respondent never consented to. Scan responses on ingestion: analysis keeps the sentiment and the product insight, loses the phone numbers and names. The same flow protects published testimonials from over-sharing customers.

Input
Great service! Manager Rosa Delgado helped after my card issue. Call me on 617-555-0142 to follow up
Detected & Masked
Great service! Manager [PERSON_NAME] helped after my card issue. Call me on [PHONE_NUMBER] to follow up
3

CRM Note Sweeps

Nightly scans over notes and custom fields inventory the off-schema PII your CRM actually holds. Sensitive categories (MEDICAL_DATA, card numbers) get masked or escalated; the record-level index powers complete DSAR responses and safe audience exports.

Input
note: spoke w/ Priya, personal cell 415-555-0132, going through chemo so deal paused till Q2
Detected & Masked
note: spoke w/ [PERSON_NAME], personal cell [PHONE_NUMBER], [MEDICAL_DATA] so deal paused till Q2
4

List Import Screening

Event-booth CSVs and partner lists arrive messy: names in email columns, phone numbers in company fields, sometimes an SSN someone typed into the wrong box. Scan imports field by field before they enter the ESP, quarantine anomalies, and keep suppression-list matching accurate.

Input
company: "call his cell 202-555-0177", email: "Robert Chen", notes: "dob 4/12/71"
Screening Verdict
3 misplaced identifiers found → row quarantined for review before ESP sync
5

Consent-Aware Egress Gates

When a customer opts out of sale/sharing, tags should stop sending their data — but enforcement lives in dozens of integrations. A detection gate at each egress scans outbound payloads and blocks identifier types that the destination's consent state does not permit, with an audit record per decision.

Input
audience_sync: {email: "[email protected]", status: "opted_out_sharing"}
Gate Decision
EMAIL_ADDRESS detected + opt-out flag → sync blocked, decision logged
6

Hashed Audience Preparation

Platforms accept identifiers only via hashed match channels; clean rooms require de-identified ingress. With mask_mode: "hash", detected identifiers are replaced with consistent tokens — the same email always hashes the same — so match rates and joins survive while raw PII never leaves your boundary.

Input
row: [email protected], +1 617 555 0142, LTV 1240, segment "spring-vip"
Detected & Hashed
row: a8f3c2e19b44d7f0, 55021ee8a9c13b6d, LTV 1240, segment "spring-vip"
<200ms
Typical Latency — Tag-Layer Ready
150+
Entity Types
60+
Languages — Global Campaigns
3
Mask Modes: replace, redact, hash

Wire Detection into Your Martech Stack

Same endpoint for the tag layer, the survey pipeline, and the audience-export job

cURL — Audit an Analytics Event Payload for PII

# Scan a GA4-bound event payload (URL + params) before it ships
curl -X POST https://piidetectionapi.com/api/moderate.php \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "YOUR_API_KEY",
    "api_type": "pii_detection",
    "text": "page_location=https://shop.example.com/[email protected]&fname=Jane event=purchase value=129.00 search_term=gift for dr. imani harris",
    "entities": ["EMAIL_ADDRESS", "PERSON_NAME", "PHONE_NUMBER", "ADDRESS", "ZIP_CODE"],
    "mask_mode": "replace",
    "threshold": 0.6,
    "custom_instruction": "Do not flag product names or brand names as person names."
  }'
# Response
{
  "detected_entities": [
    {"type": "EMAIL_ADDRESS", "text": "[email protected]", "start": 63, "end": 83, "confidence": 0.99},
    {"type": "PERSON_NAME", "text": "Jane", "start": 90, "end": 94, "confidence": 0.87},
    {"type": "PERSON_NAME", "text": "dr. imani harris", "start": 147, "end": 163, "confidence": 0.93}
  ],
  "anonymized_text": "page_location=https://shop.example.com/thanks?order=88213&email=[EMAIL_ADDRESS]&fname=[PERSON_NAME] event=purchase value=129.00 search_term=gift for [PERSON_NAME]",
  "entities_detected": 3,
  "processing_time_ms": 149,
  "mask_mode_used": "replace",
  "status": 200
}

Python — Scrub Survey Free-Text Before Analysis

import requests

API_URL = "https://piidetectionapi.com/api/moderate.php"

def scrub_response(text: str) -> dict:
    """Mask PII in a survey answer before it reaches dashboards."""
    resp = requests.post(API_URL, json={
        "api_key": "YOUR_API_KEY",
        "api_type": "pii_detection",
        "text": text,
        "entities": [
            "PERSON_NAME", "EMAIL_ADDRESS", "PHONE_NUMBER",
            "ADDRESS", "CREDIT_CARD_NUMBER", "MEDICAL_DATA",
        ],
        "mask_mode": "replace",
        "threshold": 0.55,
    }, timeout=30)
    return resp.json()

for row in survey_export:            # e.g. NPS verbatims CSV
    data = scrub_response(row["comment"])
    row["comment"] = data["anonymized_text"]

    # keep an aggregate privacy metric per campaign
    if data["entities_detected"]:
        stats[row["campaign"]] += data["entities_detected"]

warehouse.load("nps_verbatims_clean", survey_export)
print("PII found per campaign:", dict(stats))

JavaScript — Hash Identifiers for a Clean-Room Export

// Node.js: prepare an audience file with consistent hashing
async function hashRow(rowText) {
  const res = await fetch(
    "https://piidetectionapi.com/api/moderate.php",
    {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        api_key: process.env.PII_API_KEY,
        api_type: "pii_detection",
        text: rowText,
        entities: ["EMAIL_ADDRESS", "PHONE_NUMBER",
                   "PERSON_NAME", "ADDRESS"],
        mask_mode: "hash",   // same value → same token
        threshold: 0.6
      })
    }
  );
  const data = await res.json();

  // belt-and-suspenders: block rows where raw PII survived
  if (data.entities_detected > 0 &&
      data.anonymized_text === rowText) {
    throw new Error("unmasked PII in export row");
  }
  return data.anonymized_text;
}

// joins inside the clean room still work: hashes are consistent
const outRows = [];
for (const row of audienceCsvRows) {
  outRows.push(await hashRow(row));
}
await cleanRoom.upload("q3-vip-audience", outRows.join("\n"));
Audit before you automate

Get a key on the get started page, run a week of URLs and survey verbatims through the interactive demo or a batch script, and see what is already leaking. Then wire the gate into the tag layer on usage-based tiers from the pricing page.

Hashing: Matching Without Exposure

Modern ad measurement runs on matching — your customer list against a platform's users, your conversions against a publisher's impressions, your first-party segments against a retail media network's shoppers inside a clean room. Every one of those joins needs a common key, and the raw key is exactly what policy and law say you must not hand over. The industry's answer is consistent hashing: transform the identifier so it matches without revealing.

The API's mask_mode: "hash" operationalizes this at the content level, which matters more than it sounds. File-level hashing tools assume identifiers sit in clean, labeled columns; real exports have emails in comment fields, phone numbers in the company column, and names embedded in sentences. Detection-driven hashing finds every identifier wherever it sits and replaces each with a deterministic token — the same email always yields the same hash, so distinct counts, joins, and frequency caps keep working across files and runs. Non-identifier content (LTV, segment labels, product interest) passes through untouched, preserving analytical value.

Two cautions keep the lawyers happy. Hashed identifiers are pseudonymous, not anonymous — GDPR still applies to them, so hashing reduces exposure rather than erasing duty. And clean-room ingress rules typically prohibit raw PII outright, making the pre-upload scan a contractual control, not a courtesy; the belt-and-suspenders check in the code above is what a platform audit wants to see. For the pipeline view — hashing at the warehouse and streaming tier — see PII detection in ETL and streaming pipelines, and for the retail-side view of the same customer data, our retail & e-commerce page.

Marketing & AdTech PII Detection FAQ

What marketing ops, analytics engineers, and privacy counsel ask before integrating

What happens if PII has already reached our GA4 property?

Remediate in three steps: stop the inflow (fix the leaking form or template, add the detection gate in server-side tagging), use the platform's data-deletion request tooling for the affected date ranges and parameters, and document both actions. An API-driven audit of your recent URLs and event exports tells you precisely which parameters and pages leaked, which turns the deletion request from guesswork into a scoped operation — and gives the privacy office the paper trail.

Is a hashed email still personal data?

Under GDPR and CPRA's definitions, generally yes — hashing is pseudonymization, because the hash still singles out an individual and can be matched by anyone with the same input. That is exactly why platforms accept it for matching. Treat hashed identifiers as regulated data with reduced risk: keep them out of systems that should hold nothing personal, and use them where policy permits matching. The legal nuance is covered in our GDPR guide and CCPA/CPRA guide.

Can detection run inside our server-side tagging container?

Yes — that is the natural insertion point. A custom tag or transformation calls the API with the event's URL and parameter values, and forwards the masked payload to vendors. Typical latency under 200ms fits server-side budgets, and you can scope scanning to the fields that historically leak (page_location, search terms, form echoes) to keep cost and latency minimal. For very high-volume properties, teams sample in audit mode first, then enforce on the parameters that actually show findings.

Will scanning survey verbatims distort our text analytics?

No — masking preserves sentence structure and sentiment-bearing words, replacing only the identifier spans with typed placeholders. Topic models, sentiment scoring, and LLM summarization all run normally on masked text, and the placeholders themselves are analytically useful ("responses containing [PHONE_NUMBER] correlate with support complaints"). If you need respondent-level linkage across waves, use mask_mode: "hash" so the same respondent's identifiers stay joinable without being readable.

How does this interact with consent-mode and opt-out signals?

Detection and consent management are complementary layers: the CMP decides whether a destination may receive data for a purpose; detection verifies what the payload actually contains. Pairing them closes the classic gap — a user opts out of sharing, yet a misconfigured tag keeps transmitting their email in a URL. The egress-gate pattern (scan payload, check consent state, block or mask, log the decision) is the auditable enforcement CPRA regulators have signaled they expect.

Can we detect sensitive categories we must never use for targeting?

Yes. Entity types like MEDICAL_DATA, ETHNIC_GROUP, RELIGION, SEXUAL_ORIENTATION, and POLITICAL_AFFILIATION flag content that CPRA treats as sensitive personal information and ad platforms prohibit as targeting signals. Scanning segment definitions, enrichment feeds, and survey data for these types keeps prohibited signals from silently entering audience logic — a growing enforcement focus after recent health-data cases. The full list is on the entities page.

Related Resources

Deep dives on the identifiers, regulations, and adjacent industries marketing teams work with

Measure Everything. Leak Nothing.

Paste a campaign URL or a survey verbatim into the demo and see every identifier flagged with offsets in milliseconds. Then put the same gate in front of your analytics.