← DevLog

3 min read

A prefilled contact link that keeps names out of your logs

Put form values in the query string and they end up in server logs, CDN logs and the Referer header. One character keeps them in the browser. How we did it, and the framework trap that emptied the form on a first visit.

Gunnie.ai, our own platform, sometimes needs to hand a customer's question over to us. The simplest way is a link that opens the contact form on gunnie.nl with the name, company, email address and question already filled in. The customer checks it and presses Send.

The usual way to build that link is a query string: /contact?name=…&email=…&message=…. That puts a name, an email address and a question about someone's shop in a lot of places nobody meant to keep them.

Where a query string goes

  • The access log of the web server.

  • The request log of the CDN in front of it.

  • The Referer header, which the browser sends to scripts and images loaded from other sites. Depending on the referrer policy, that can include the full address.

  • Analytics tools that store the full page address.

Each of those is a copy of personal data, kept for as long as that system keeps logs, and usually not mentioned in the privacy statement.

One character

Everything after a # in an address is the fragment. The browser never sends it to the server. It is not in the request, so it is not in the server log or the CDN log, and the Referer header never includes it. Only the page itself can read it, with a line of script.

So our link looks like this:

/en/contact#topic=audit&name=…&company=…&email=…&message=…&source=gunnie-ai

The server sees a request for /en/contact and nothing else. The form reads the fragment and fills itself in.

It is not a secret. The address is still in the browser history, and any script on the page could read the fragment if it wanted to. What it avoids is the copies in logs that nobody looks at and nobody deletes.

The trap: an empty form on the first visit

The first version worked when you clicked through from another page on the site, and failed when you opened the link directly. The form came up empty.

Our pages are prerendered and then taken over by the framework in the browser. While that happens, the router replaced the address without its fragment, and put it back afterwards in decoded form. The form looked during that window and found nothing. And because the fragment came back decoded, an & typed inside a message would have split it into two fields.

The fix: while the page is starting up, the form reads the fragment from the navigation entry, which holds the address the browser actually loaded. After a navigation inside the site it uses the current address as before.

What a link can and cannot do

  • The topic is selected by a stable key that is the same in Dutch and English, so renaming a label never breaks a link. An unknown key leaves the default.

  • The newsletter box cannot be prefilled. Consent is a tick the visitor makes.

  • The visitor still passes the bot check and still presses Send. The link fills a form; it does not send anything.

Check yours

Search your server or CDN logs for email= and for %40, the encoded @. The usual sources are a form that submits with GET, a thank-you page reached through a redirect like /thanks?email=…, and prefilled links in mail campaigns. Each hit is a customer's address in a log file. Move the values into the fragment, or into a POST body, and the copies stop.