> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.laposta.org/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.laposta.org/_mcp/server.

# Creating a link with a variable

> Let subscribers log in automatically or recognise them on your website when they click through from your newsletter.

You can include a subscriber variable in any link in your newsletter. When sending, Laposta fills in that variable for each subscriber, so that everyone receives their own URL.

Only do this if you have a specific purpose for it, such as logging your subscribers in to your website automatically or recognising them as soon as they click through from your newsletter. If you want to customise the text, the subject or the preview text for each subscriber, you can [personalise](/hoe-personaliseer-ik-mijn-nieuwsbrief) your newsletter in the usual way.

## Putting the variable in the URL

You need an [extra field in your list](/hoe-maak-ik-extra-velden-aan-voor-mijn-lijst) containing the value for each subscriber. In addition, when filling in your template in [step 4](/stap-4-vul-het-sjabloon), you can [place a link in your newsletter](/hoe-plaats-ik-een-link-in-mijn-nieuwsbrief) with the corresponding subscriber variable in the place where that value should go.

Suppose you want subscribers to go straight to their own customer area on your site. You have a separate code for each customer, so you create the `code` field in your list. For customer Peter Petersen, the field value is `ac9hj8er12`. The link to your website then looks like this:

```text
http://mijnsite.nl/webshop/acties/?code={{code}}
```

When sending to Peter Petersen, Laposta turns this into:

```text
http://mijnsite.nl/webshop/acties/?code=ac9hj8er12
```

You can use any field from your list in a URL in this way, for example your subscriber's first name, last name or email address.

## Only putting the value in the field

For every link, Laposta records whether it has been clicked and how many times, including links with a subscriber variable. If Peter Petersen clicks his link twice, you will see this reflected in [the clicks for your campaign](/welke-statistieken-registreert-laposta-van-mijn-nieuwsbrief).

For this to work, the field in your list must only contain the value, so `ac9hj8er12` and not `http://mijnsite.nl/webshop/acties/?code=ac9hj8er12`. If you enter the entire URL as the field value instead, the link will still work, but Laposta will not record any statistics for this specific link. You will also no longer be able to use that field value in other URLs.

## Encoding values with special characters

Laposta copies the value of the variable exactly as it appears in your list and does not URL-encode it. This is because the variable can also be part of the path, where URL encoding is undesirable.

If you use the variable in the query string, as in the example above, and the value contains characters other than letters, numbers, `-`, `.`, `_` and `~`, make sure that you enter that value into your list already URL-encoded.

## Related articles

#### [Personalising your newsletter with variables](/hoe-personaliseer-ik-mijn-nieuwsbrief)

Automatically insert your subscribers' name or other details into your text, subject…

#### [Which subscriber details can you choose?](/welke-gegevens-van-mijn-relaties-voer-ik-in)

Besides the required email address, you can import all relevant data for…

#### [Creating fields for extra data](/hoe-maak-ik-extra-velden-aan-voor-mijn-lijst)

Create extra fields for your list, such as a text, numeric, date or multiple-choice field.

#### [Having your newsletter forwarded with a mail-a-friend link](/hoe-kan-ik-mijn-nieuwsbrief-laten-doorsturen-door-mijn-relaties-aan-anderen)

Insert a link that allows subscribers to share the webversion of your newsletter by…