Docs

Audit Trail (Beta)Beta

8 min readUpdated November 3, 2026

The Audit Trail makes your consent log tamper-evident. Every log entry is sealed with a signature that also covers the entry before it, so any later change or deletion made outside the plugin can be detected.

Use it when you need to prove consent, not just record it, for example when a customer complains about receiving emails, or a data-protection authority or auditor asks for evidence.

Beta. The Audit Trail doesn’t change how the opt-in checkbox, logging, CRM forwarding or webhooks work. If anything looks wrong, please contact support.

Before you start#

  • General → Log every submission must be on. Only logged entries can be signed.
  • WP-Cron must run for the daily check. See Requirements & Installation.
  • If your site is behind Cloudflare, a load balancer or a reverse proxy, turn on Geo rules → Behind a trusted proxy, so the real visitor IP is recorded. See GDPR Geo-Detection.

Where to find it#

Go to WP Smart Consent → Audit trail.

Audit trail tab with the BETA badge, the Store IP address & browser switch turned on, a green "Verified 2026-11-02 23:35:24 UTC — 23 entries chained and unmodified." result with a Verify now button, and the How to use the audit trail guide ending with the wp-config.php line The key in the wp-config.php line is masked in this screenshot. On your site, the guide shows your actual key.

The tab has:

  • Store IP address & browser: whether the visitor’s IP address and browser (user-agent string) are recorded with each entry.
  • Log integrity: the result of the latest check, and a Verify now button.
  • How to use the audit trail: a built-in guide, which also shows the line for moving the signing key into wp-config.php.

The Logs tab shows the same integrity status above the table. In the IP column, a shield icon marks signed entries.

Setting it up#

  1. Open Audit trail.
  2. Decide whether to store IP addresses and browser details. Turn Store IP address & browser on or off.
  3. Click Save.
  4. Click Verify now to run a first check.
  5. Optional: move the signing key into wp-config.php (see The signing key).
  6. Update your privacy policy (see Privacy and retention).

Signing is always on. There’s nothing to turn on for it.

What is recorded#

Each entry keeps the fields the Customers Log stores: consent state, source, contact fields and time. The Audit Trail adds:

FieldWhat it is
Time (UTC)The exact time of the entry, in UTC.
IP addressThe visitor’s IP address, when Store IP address & browser is on.
BrowserThe visitor’s user-agent string, when Store IP address & browser is on.
Previous signatureThe signature of the entry before it.
SignatureThis entry’s seal.

Store IP address & browser#

SiteDefault
New installsOn
Sites upgraded from a version before 1.5.0Off, so the plugin doesn’t start collecting a new kind of personal data without your decision

How the seal works#

Each entry is signed with HMAC-SHA256, using a secret key that only your site holds. The signature covers:

  • the signature of the previous entry
  • the entry’s time (UTC), user ID, consent state, source, name, email, phone, country, city, state, company, address lines, postcode, extra field values, IP address and browser

Because each signature includes the one before it, the entries form a chain. If anyone edits or removes an entry directly in the database, for example with phpMyAdmin, a migration tool or another plugin, the chain no longer adds up and the check fails at that entry. Entries are added one at a time, so two checkouts at the same moment can’t break the chain.

The deletion ledger#

Deletions made through the plugin are recorded in a separate table, {prefix}wpsc_logger_gaps. Each row records where a deleted run of entries started and ended (by signature), how many entries it held, the reason (manual, cleanup or retention), the user who deleted them and the time. It holds no contact data.

During a check, the plugin uses the ledger to step over recorded deletions, so these never break verification:

  • the bin button on a row in Logs, which deletes one entry
  • Log maintenance → Delete logs
  • automatic Log retention
  • deleting a single entry through the REST API

Checking the log#

  • Automatically: the whole log is checked once a day, right after the daily retention clean-up.
  • On demand: click Verify now in the Audit trail or Logs tab. It’s worth doing before an audit or when you’re answering a complaint.

A passing result reads like “Verified 2026-11-02 21:26:06 UTC — 1,284 entries chained and unmodified.”

Entries created before 1.5.0 have no signature. They stay in the log and are counted separately: “… (12 older entries predate 1.5.0 and cannot be verified).”

If the check fails#

The result names the first entry where the chain breaks, and the reason:

MessageWhat it means
an entry was modified outside the pluginThat entry was changed directly in the database. Its content can no longer be relied on as evidence.
entries were deleted outside the pluginEntries are missing just before this one, and the plugin didn’t delete them.
the start of the chain is missingThe oldest signed entries were removed outside the plugin.

When the daily check fails, administrators also see a red notice at the top of every admin page:

WP Smart Consent: the consent log failed its integrity check at entry #123 (row_modified, checked 2026-11-03 02:00:00 UTC). Entries may have been modified or deleted outside the plugin.

The notice stays until a check passes.

What to do:

  1. Don’t try to “fix” the entry. A failed check can’t be repaired, because the point is that the history stays honest.
  2. Note the entry number, the reason and the time of the check.
  3. Find out who had database access, and whether a migration, restore or other plugin touched the {prefix}wpsc_logger table.
  4. Keep a written note of what you found.

Entries recorded after the break are still checked and still valid, but the daily check stops at the first break and keeps reporting it.

Backups and staging: restoring a backup or copying the site doesn’t break the chain, as long as the whole database is restored together: the log table, the ledger table and the options that hold the signing key. If the key is in wp-config.php, copy that too.

Producing evidence for an audit or complaint#

  1. Open Audit trail and click Verify now. Take a screenshot of the green result, which includes the date and time.
  2. Open Logs and search for the person’s email address. Take a screenshot of their entries. Hover over the IP cell to show each entry’s signature.
  3. Click Export CSV for a spreadsheet of their entries. It includes every stored field: contact details and address, consent, source, extra field values (extra_data), user ID, the UTC time (logged_at_utc), IP address, browser (user_agent) and both signatures (prev_hash, record_hash). That’s everything needed to re-check each signature.
  4. If you’re asked how the records are protected, you can say: “Each consent record is signed with HMAC-SHA256, using a key held only by our website. Each signature includes the previous record’s signature, so altering or removing any record is detectable.”

Privacy and retention#

  • IP addresses are personal data. Say in your privacy policy that you keep IP addresses and browser information as proof of consent, and for how long.
  • Limit how long records are kept with General → Log retention (days). Deletions by retention are recorded, so the chain stays valid.
  • Erasure requests: search for the person in Logs and delete each of their entries with the bin button, not in the database, so the deletion itself becomes part of the record and verification keeps passing. See The Customers Log → Deleting entries.

The signing key#

The plugin creates a random 64-character key the first time it’s needed and stores it in the WordPress options table (wpsc_log_hmac_key). That’s fine for most sites.

For stronger protection, so that someone with database access alone can’t produce valid signatures, move the key into wp-config.php. The How to use the audit trail guide shows the line ready to copy, with your current key:

define( 'WPSC_LOG_HMAC_KEY', 'your-current-key-exactly-as-shown' );

Copy the value exactly. Changing the key later makes every existing signature fail the check. Once the constant is set, the guide says the key is defined in wp-config.php instead of showing it.

Limits of the Beta#

  • Someone who has both database access and the signing key can rewrite entries and recompute signatures. Keeping the key in wp-config.php makes this harder.
  • Removing the most recent entries from the end of the log, outside the plugin, isn’t detected by the chain alone. Regular exports or backups give you a second record to compare with.
  • The check reads the whole log in batches. On very large logs it can take a while.

FAQ#

Does this replace a consent-management platform? No. WP Smart Consent records marketing opt-ins from your checkouts and forms. The Audit Trail makes those records trustworthy. Cookie consent and other legal bases are separate.

Does it slow down checkout? No. Signing an entry is a single hash calculation. The daily check runs in the background.

Can I verify the log from my own tools? Yes. Administrators can call GET /wp-json/wpsc/v1/logger/verify, which runs the check and saves the result, and GET /wp-json/wpsc/v1/logger/integrity, which returns the last result. Both need a REST nonce. See the Developer API.

Troubleshooting#

ProblemCause and fix
Not checked yet. Click Verify now, or wait for the nightly check.No check has run. Click Verify now. If it never updates by itself, WP-Cron isn’t running.
The IP column is emptyStore IP address & browser was off when the entry was recorded (the browser isn’t stored either), or the entry predates 1.5.0.
Every entry shows the same IPYour site is behind a proxy. Turn on Behind a trusted proxy. Existing entries keep the address they were signed with.
The check failed right after a migrationThe log table was copied without the ledger table or the signing key. Restore all three together, or keep the old site for evidence.
The check failed after adding WPSC_LOG_HMAC_KEYThe value doesn’t exactly match the key that signed the entries. Copy the exact value from the guide.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only