# Authenticity Paradata

Source: https://www.potatoannotator.com/docs/features/authenticity

Potato's `authenticity` block records whether an annotator left the page, copied the item, or pasted text from somewhere else while answering each item, and stores the record as counts and durations with no copied or pasted text. In survey research, [paradata](https://en.wikipedia.org/wiki/Paradata) are data about the process by which the data were collected. The block works on every task type, radio buttons, Likert scales, spans, and rankings included, while [keystroke logging](/docs/features/keystroke-logging) covers only free-text fields. On the server, Potato turns each item's record into named flags, and every flag lists the numbers that fired the flag.

The block is off by default, so upgrading Potato never starts recording annotators. Setting `authenticity.enabled: true` is the whole minimum configuration, and the [configuration](#configuration) section lists every other option. A flag reports a process signal, such as a copy of the item followed by a paste of 10 or more words of outside text. Potato does not detect LLM-written answers, and no flag names a cause. Read each flag as evidence for a human reviewer, and never tie a flag to automatic rejection, withheld pay, or a ban.

A runnable example ships with Potato:

```bash
python potato/flask_server.py start examples/advanced/authenticity/config.yaml -p 8000
```

The example serves a Likert scheme and a radio scheme on port 8000, and the Authenticity panel in the admin dashboard's Behavioral tab shows the flags.

## Signals the browser records

Potato's browser script keeps one set of running totals for each view of an item. Every page load and every move to another item starts a new view. The script posts the whole snapshot to `/api/track_authenticity` every `flush_interval_ms` (10 seconds by default) while anything has changed, every 30 seconds on a quiet page while the tab is visible, and again when the page is hidden, closed, or moved to the next item. Each post replaces the previous snapshot for the same view, so a retried post cannot count an event twice. To merge every view of one item, the server sums the counts and keeps the largest value of each maximum and the narrowest window. The flags are then evaluated on the merged record.

| Signal | Fields |
|---|---|
| Tab hidden (another tab, a minimized window) | `hidden_events`, `hidden_ms` |
| Window unfocused while visible (another window) | `blur_events`, `blur_ms` |
| Longest single absence | `max_away_ms` |
| Away in a page the task opened, such as a codebook link | `linked_away_events`, `linked_away_ms` |
| Copies of the item text | `item_copy_events`, `item_copy_chars` |
| Selections and right-clicks on the item | `item_select_events`, `item_context_menu_events` |
| Other copies and cuts | `other_copy_events`, `cut_events` |
| Pastes | `paste_events`, `item_paste_events`, `external_paste_events`, `external_paste_words`, `max_external_paste_words` |
| An item copy followed by an absence or a paste | `max_away_after_item_copy_ms`, `max_paste_words_after_item_copy`, `copy_away_pairs` |
| Window size | `min_window_ratio`, `large_screen`, `resize_events`, `zoom_changes` |
| Mouse | `pointer_moves`, `pointer_distance_px`, `mouse_clicks`, `teleport_clicks` |
| Automation | `webdriver`, `untrusted_events` |
| Device | `touch_input` |
| Time | `elapsed_ms` (measured in the browser), `server_span_ms` (first to last post, measured by the server) |

An absence shorter than `min_away_ms` (1 second by default) is not counted, so switching windows past a notification does not register as leaving the task. Time away that begins within 3 seconds of clicking a link that opens a new tab goes into the `linked_away_events` and `linked_away_ms` fields. No flag reads the two linked-away fields. Moving focus into an embedded frame, such as a video player, does not count as leaving. A copy counts as an item copy when the selection starts inside the item area, or when the copied text runs to 12 or more characters and appears in the item. Selecting 20 or more characters inside the item adds one to `item_select_events`.

A paste counts as outside text unless the pasted text runs to 12 or more characters and appears in the item, matches the annotator's last copy on the page, or already appears in one of the page's text fields. Item text shorter than 12 characters therefore counts as outside text when pasted, and no paste under 12 characters can reach the 10-word thresholds. Words are counted by splitting the pasted text on whitespace. For each absence that follows an item copy, `copy_away_pairs` stores three numbers: (1) the delay between the copy and the start of the absence, (2) the length of the absence, and (3) the length of the copy. The browser keeps the 20 longest absences per view, and the merged record keeps the 200 longest per item.

Mouse fields count only a mouse pointer, and `pointer_moves` counts at most one move per 50 milliseconds, so a high-rate mouse does not dominate the total. A teleport click is a mouse press more than 5 pixels from the previous press with no pointer movement in between. `min_window_ratio` is the browser window's width divided by the screen's available width, and `large_screen` is true when the screen's available width is 1,200 pixels or more. A touch or pen press sets `touch_input`.

### Text kept out of the record

Potato never sends copied or pasted text to the server. The browser compares each copy and paste against the page in memory, keeps a character or word count, and discards the text. On the server, Potato keeps only the known numeric and true-or-false fields from each post, drops every other field, and clamps each value to a fixed range, so a modified page cannot send text along with the counts. Nothing in the record describes keystrokes, answer content, or which page or application the annotator went to.

## Flags

The server evaluates nine flags on each item's merged record:

| Flag | Fires when (defaults) | Severity |
|---|---|---|
| `automation` | The browser reports `navigator.webdriver`, which a browser driven by automation software sets | suspect |
| `copy_then_paste` | The annotator copied the item, then pasted 10 or more words of outside text | suspect |
| `copy_then_away` | One absence of 10 seconds or more began within 60 seconds of a copy of 40 or more item characters | suspect |
| `external_paste` | The largest paste of outside text had 10 or more words | review |
| `item_copied` | The annotator copied 40 or more characters of the item in total | review |
| `away_from_task` | The annotator left the page 3 or more times, or was away 60 seconds or more and for at least half the time on the item | review |
| `split_screen` | The window was 60% of the screen width or narrower, on a screen 1,200 pixels wide or more, with no touch input | review |
| `pointer_teleport` | 3 or more mouse clicks landed at a new position with no pointer movement in between | review |
| `synthetic_input` | 3 or more pointer or key events had `isTrusted = false`, meaning a script generated the events | review |

The flags on one item do not repeat each other. When `copy_then_paste` fires, `copy_then_away`, `external_paste`, and `item_copied` do not fire on the same item, and a `copy_then_away` flag suppresses `item_copied`. The `copy_then_away` rule needs all three conditions to hold for one absence, so a long copy and an unrelated absence several minutes later do not combine into a flag. Time away in `away_from_task` sums hidden-tab and unfocused-window time across every view of the item, and leaves out time in pages the task opened.

An item's verdict is `suspect` when any suspect-severity flag fires, `review` when only review-severity flags fire, and `ok` when no flag fires. Each flag stores a plain-language explanation and the evidence values behind the flag, for example "Copied 212 characters of the item text, left the page 3.0s later and stayed away for 41.2s." Thresholds stay on the server and never reach the browser, so an annotator cannot read off how long an absence the rules allow. When the browser recorded at least one touch or pen press on the item, the verdict adds the note that pointer-based rules may not apply.

## Configuration

The fragment below adds the `authenticity` block and the export switch to an existing config. Apart from `enabled`, `phases`, the two thresholds, and `export_include_authenticity`, every value shown is the default:

```yaml
authenticity:
  enabled: true
  min_away_ms: 1000
  flush_interval_ms: 10000
  track_pointer: true
  disclose_to_annotators: true
  phases: [annotation]
  detection:
    enabled: true
    thresholds:
      away_from_task.min_events: 5
      copy_then_away.min_away_ms: 20000

export_include_authenticity: true
```

A higher bar for `away_from_task` and `copy_then_away` leaves fewer flags to read in a task where annotators often step away briefly. `phases: [annotation]` keeps the tracker off the consent and survey pages, as [recording only after consent](#recording-only-after-consent) explains.

| Key | Default | Meaning |
|---|---|---|
| `enabled` | `false` | Master switch. With `false`, the script never loads and the server ignores posts. |
| `min_away_ms` | `1000` | The shortest absence counted as leaving the page. A positive integer. |
| `flush_interval_ms` | `10000` | How often the browser posts a changed snapshot. A positive integer. |
| `track_pointer` | `true` | `false` removes the mouse-movement listener, which stops `pointer_moves`, `pointer_distance_px`, and the `pointer_teleport` check. |
| `disclose_to_annotators` | `true` | Shows a notice of what is recorded. `false` hides the notice and logs a warning at startup. |
| `disclosure_text` | `null` | A custom notice. `null` shows the default notice. |
| `phases` | `null` | The phase types or page names the tracker records on. `null` records on every page. |
| `detection.enabled` | `true` | `false` keeps recording and stores no verdict. |
| `detection.thresholds` | `{}` | Overrides for the keys in the threshold table below. |
| `export_include_authenticity` | `false` | A top-level key. `true` writes the authenticity file on CSV, TSV, `data_package`, and `psych_ds` export. |

The `automation` rule has no threshold. Every other rule's threshold can be overridden:

| Threshold key | Default | Rule |
|---|---|---|
| `copy_then_paste.min_words` | `10` | Words of outside text pasted after an item copy |
| `copy_then_away.min_away_ms` | `10000` | Length of the absence |
| `copy_then_away.min_copy_chars` | `40` | Characters of item text in the copy |
| `copy_then_away.max_gap_ms` | `60000` | Longest delay between the copy and the absence |
| `external_paste.min_words` | `10` | Words in the largest paste of outside text |
| `item_copied.min_chars` | `40` | Total characters of item text copied |
| `away_from_task.min_events` | `3` | Number of absences |
| `away_from_task.min_ms` | `60000` | Total time away |
| `away_from_task.min_fraction` | `0.5` | Share of the item's elapsed time spent away |
| `split_screen.max_window_ratio` | `0.6` | Window width as a share of screen width |
| `pointer_teleport.min_clicks` | `3` | Clicks with no movement in between |
| `synthetic_input.min_events` | `3` | Script-generated pointer and key events |

An unknown threshold key or a non-numeric value stops Potato at startup. Potato's error for an unknown key lists the known keys, and a non-numeric value gets an error saying the threshold must be a number.

### Recording only after consent

Without a `phases` list, the tracker records on every page, the consent page included. Each entry in `phases` is a phase type (`consent`, `prestudy`, `instructions`, `training`, `annotation`, or `poststudy`) or a page name from the config's `phases` block, and a page name picks out one page when a study has two pages of the same type. An empty list or an unknown value stops Potato at startup. Potato's error for an unknown value lists the valid values, and an empty list gets an error asking for a non-empty list or for the key to be left out. On pages outside the listed phases, the script does not load, and the server answers a stray post from a cached page with a 200 and stores nothing. After annotation ends, a post for one of the annotator's own items still counts as annotation, because the last item's final post arrives after the annotator has moved on.

The notice stays on every phase page and annotation page whatever `phases` says, so a participant can read the notice before consenting. Neither the login page nor a runtime-phase page shows the notice, and the tracker does not run on either. When `phases` leaves out `annotation`, the admin rollup does not count annotated items as `paradata_missing`.

## Where the data lands

### In user_state.json

Each item's record sits in `<output_annotation_dir>/<user>/user_state.json` under `instance_id_to_behavioral_data.<instance_id>.authenticity`, in three parts: (1) `views`, each view's last snapshot with `first_seen` and `last_seen` server timestamps and the phase and page; (2) `summary`, the merged record that the flags read; and (3) `verdict`, with the level, each flag's explanation and evidence, and any notes. Consent, instructions, survey, and training pages all share one `__phase_page__` record, and each view in the record is stamped with the phase and page. During annotation, a post for an item not assigned to the annotator gets a 403 and stores nothing. Potato stores at most 50 views per record. Once a record reaches 50 views, the server ignores each new view with a logged warning and keeps updating the stored views, so the newest views are lost. The one `__phase_page__` record shares a single 50-view cap across every phase page.

The server updates the in-memory record on every post. Potato writes the record to `user_state.json` at once for a post marked final and for a post that changes the item's flags. The browser marks a post final at every item change, every tab hide, and every page close, so each tab switch is written at once. Other posts reach disk at most once a minute per annotator, or with the next annotation save, and Potato writes any held posts when the server stops on Ctrl-C or SIGTERM. A crash can lose up to a minute of paradata and no annotations.

### In the admin dashboard

The **Authenticity** panel sits in the Behavioral tab of the [Admin Dashboard](/docs/features/admin-dashboard), below the Writing Process panel, and appears only when the block is enabled. A caveat to read first opens the panel, followed by one row per annotator with items, items without paradata, page leaves, share of time away, item copies, outside pastes, automation signs, flag counts, and `authenticity_risk`. Under each row, the panel lists up to 25 flagged items with each item's explanations, suspect items first. Admins can fetch the same data as JSON from `GET /admin/api/authenticity`, or under the `authenticity` key of `GET /admin/api/behavioral_analytics`.

`paradata_missing` counts an annotator's annotated items that have no authenticity record at all. An item answered while the script was blocked or modified has no record. Every item annotated before the block was switched on lacks a record too, so read `paradata_missing` against the date you enabled the block.

`authenticity_risk` ranks annotators for review. For each flag, Potato divides the number of the annotator's records that fired the flag by the number of records plus items without paradata, caps the share at 1, multiplies the share by the flag's weight, and sums the products. The `__phase_page__` record counts as one record, so flags fired on phase pages enter the score. Weights are `automation` 0.30, `copy_then_paste` 0.25, `copy_then_away` 0.20, `external_paste` 0.08, `pointer_teleport` 0.07, `synthetic_input` 0.07, `item_copied` 0.04, `away_from_task` 0.03, `split_screen` 0.02, and `paradata_missing` 0.01. Potato's source names an automated browser and an item copied out with an answer brought back as the signals hardest to explain innocently, and the weights put the two signals first. The weights sum to 1.07, so the score orders whom to look at first rather than giving a probability.

### In the export

With `export_include_authenticity: true`, the CSV and TSV exporters write `authenticity.csv` or `authenticity.tsv` beside `annotations.csv`, with one row per annotator and annotated item. The `data_package` exporter lists `authenticity.csv` as a resource in `datapackage.json`, and the `psych_ds` exporter copies the file to `data/study-<task>_table-authenticity_data.csv`. Export with the CLI:

```bash
python -m potato.export -c config.yaml -f csv
```

The command writes both files into `./export_output`, the default output directory. Each row lists `user_id`, `instance_id`, `views`, `elapsed_ms`, `server_span_ms`, the count and maximum fields from the signal table, `min_window_ratio`, the three true-or-false fields as 1 or 0, `verdict_level`, and `flags` joined with `|`. Per-absence `copy_away_pairs` stay in `user_state.json`. The JSONL, Parquet, and Hugging Face exporters write no authenticity file, and phase pages appear only in the admin rollup.

## Pairing with keystroke logging and writing-process detection

[Keystroke logging](/docs/features/keystroke-logging) records how each free-text answer was typed, and [writing-process detection](/docs/features/writing-process-detection) turns the keystroke logs into flags such as `paste_dominant` and `offscreen_composition`. The `authenticity` block records what happened on the page around every answer, typed or clicked. A study with both free-text fields and closed-format items can enable both blocks. Writing-process detection then surfaces free-text responses that were pasted rather than typed, and the `authenticity` block surfaces label clicks that followed a copy of the item and a trip off the page. Each block takes a separate `phases` list and shows a separate notice.

The two exports share the `user_id` and `instance_id` columns, so `typing_dynamics.csv` from `export_include_typing_dynamics: true` joins to `authenticity.csv` on that pair. In the admin dashboard, the Writing Process panel and the Authenticity panel sit next to each other in the Behavioral tab. The general [behavioral tracker](/docs/features/behavioral-tracking) is on by default and takes a separate `interaction_tracking.phases` list, so a study that must record nothing before consent sets `phases` on `interaction_tracking` as well.

## Limits

Every signal is measured in the annotator's browser, so a determined annotator can block or rewrite the script. An annotated item with no record shows up in `paradata_missing`, and the server measures `server_span_ms` itself, so a modified page cannot inflate that span. A chatbot on a second device, such as a phone, leaves no trace on the page. The `mouse_clicks` count appears only as evidence, and no flag fires on fast answering. Pair the flags with [attention checks and gold items](/docs/features/quality-control) and with an instruction not to use AI tools on the items.

### False positives

Every flag has ordinary explanations. Copying a phrase of 40 or more characters from the item to look up a word, then spending 10 seconds in a dictionary, fires `copy_then_away` the same way a chatbot round trip does. A phone call or a knock at the door can fire `away_from_task`, and a small screen with notes open beside the task can fire `split_screen`. Asking annotators to consult outside sources trips the paste and away rules by design, so for such a task raise the thresholds or leave the paste and away rules out of the review criteria. Raising `copy_then_away.min_copy_chars` above the length of a typical lookup phrase keeps short lookups out of the flag.

### Accessibility and devices

Some browser extensions for keyboard navigation, and some accessibility tools, generate script events that count toward `synthetic_input`. The `synthetic_input` rule is review-severity and needs 3 script-generated events by default. For a study open to assistive-technology users, set `synthetic_input.min_events` to a value no item reaches, such as 1000000, or leave the rule out of the review criteria. The pointer rules do not apply on touch devices, and `split_screen` never fires on an item with touch input. With [`text_as_image`](/docs/features/text-as-image) on, the item has no text to copy, and the [blog post on pasting items into chatbots](/blog/keeping-annotation-items-out-of-chatbots) describes which paradata rules still fire.

## Ethics and consent

The records describe the behavior of identifiable people. State in your consent form that page-leave, copy, and paste events are recorded and that the copied and pasted text is not. While the block is enabled, the server renders the default notice on every phase page and annotation page:

> This task records when you leave this page and whether you copy the item or paste text from elsewhere — not what you copy or paste.

The server renders the notice into the page, so the notice appears even when the annotator's browser blocks scripts. Keep `disclose_to_annotators` on unless your ethics approval covers silent collection, and handle the export like any other personal data. The guidance in [Keystroke Logging Ethics](/docs/features/keystroke-logging-ethics) applies to the `authenticity` block as well.

## Further reading

- [Keystroke Logging](/docs/features/keystroke-logging), for what is captured on free-text fields
- [Writing-Process Detection](/docs/features/writing-process-detection), for the flags built on keystroke logs
- [Keystroke Logging Ethics](/docs/features/keystroke-logging-ethics), for consent language and retention
- [Behavioral Tracking](/docs/features/behavioral-tracking), for the general interaction tracker
- [Admin Dashboard](/docs/features/admin-dashboard), for the Behavioral tab
- [Raising the Cost of Pasting Annotation Items into Chatbots](/blog/keeping-annotation-items-out-of-chatbots), for how the paradata combines with `text_as_image` and attention checks

For implementation details, see the [source documentation](https://github.com/davidjurgens/potato/blob/master/docs/advanced/authenticity_paradata.md).
