> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# CHECK- (URL and cookie data)

> The tags for accessing any URL parameters and cookies: specify a name, check whether it is present, and output its value.

Sometimes a template needs information that the shop does not know on its own: a campaign identifier from the URL, an attribute from a cookie set by a third-party system. For this case, there are two tag groups that both work according to the same pattern.

`CheckURLParam-` reads any parameter from the requested address, `CheckCookie-` any cookie. Both consist of the same three tags with the same tasks.

## The pattern in three steps

| Step | URL parameter | Cookie |
| - | - | - |
| Specify the name | `CheckURLParam-TouchData()` | `CheckCookie-TouchData()` |
| Check whether present | `CheckURLParam-DataOK` | `CheckCookie-DataOK` |
| Output the value | `CheckURLParam-Data` | `CheckCookie-Data` |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~CheckURLParam-TouchData(kampagne)~

{CheckURLParam-DataOK}
   Sie kamen über die Kampagne ~CheckURLParam-Data~.
{/CheckURLParam-DataOK}

{!CheckURLParam-DataOK}
   <!-- kein solcher Parameter in der Adresse -->
{/!CheckURLParam-DataOK}
```

> [!WARNING]
>
> The tag with `TouchData` must come before the other two. It determines what `DataOK` and `Data` refer to. Without it, the two return nothing.

> [!WARNING]
>
> The shop only remembers one value per group at a time. Each new `TouchData` overwrites the previous one. You can therefore read several parameters one after the other, but not compare two at the same time. If you need a value again later, save it in a Design Control tag.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~CheckURLParam-TouchData(kampagne)~
~DC-FPkampagne_set($CheckURLParam-Data$)~

~CheckURLParam-TouchData(quelle)~
~DC-FPquelle_set($CheckURLParam-Data$)~

Kampagne {DC-FPkampagne(sommer)}Sommer{/DC-FPkampagne(sommer)}
```

## The difference between DataOK and Data

Both can be used as area tags, and they check different things.

| Tag | Applies if |
| - | - |
| `…-DataOK` | the parameter or cookie is present at all |
| `…-Data` | a non-empty value is present |

> [!NOTE]
>
> The difference shows with a parameter without a value. With the address `…/?flag=`, `CheckURLParam-DataOK` applies because the parameter is there. `CheckURLParam-Data` does not apply because there is no value after it. For the question "was this parameter passed", use `DataOK`; for "does it contain a value", use `Data`.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~CheckURLParam-TouchData(druckansicht)~

{CheckURLParam-DataOK}
   <!-- greift auch bei ?druckansicht= ohne Wert -->
   <link rel="stylesheet" href="css/druck.css">
{/CheckURLParam-DataOK}
```

## Reading URL parameters

### CheckURLParam-TouchData()

Specifies which parameter of the requested address is read. The name goes in the parentheses.

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
https://www.ihr-shop.example/?parametername1=wert1&parametername2=wert2
```

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~CheckURLParam-TouchData(parametername2)~
```

> [!WARNING]
>
> The parameter name is searched for exactly as you write it. Upper and lower case matter. Without a name in the parentheses, the tag is invalid.

### Getting the name from another tag

`CheckURLParam-TouchData()` supports tag-in-tag. The parameter name can therefore come from another tag.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~DC-FPcheck_set(checkme)~
~CheckURLParam-TouchData($DC-FPcheck$)~
```

> [!WARNING]
>
> This option only exists for URL parameters. `CheckCookie-TouchData()` does not evaluate a tag in the parentheses; there, the name must be fixed in the template.

## Reading cookies

### CheckCookie-TouchData()

Specifies which cookie is read.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~CheckCookie-TouchData(meinCookie)~

{CheckCookie-DataOK}
   Wert: ~CheckCookie-Data~
{/CheckCookie-DataOK}

{!CheckCookie-DataOK}
   Dieses Cookie ist nicht gesetzt.
{/!CheckCookie-DataOK}
```

> [!WARNING]
>
> The shop searches for the name in the cookie header of the request. If another cookie's name ends with your name, its value may be found: a search for `sitzung` also finds `benutzersitzung`. Therefore, choose unique names and check the result before you build on it.

> [!NOTE]
>
> A cookie whose value is in quotation marks is recognised correctly. The quotation marks themselves are not part of the value. The shop removes trailing spaces from a value without quotation marks.

> [!WARNING]
>
> A cookie comes from the visitor's browser and can be changed there. Treat the value like any other external input and do not derive any authorisation from it.

## Using external input safely

Both groups output values that the visitor determines themselves. Anyone can change the address, and the cookie as well.

> [!NOTE]
>
> For output in running text, this is uncritical: the shop outputs the values HTML-encoded, so an injected element is displayed as text and not executed.

> [!WARNING]
>
> In other contexts, this is not enough. Never insert such a value unchecked into JavaScript, an `href` attribute or a redirect. Instead, check it against a fixed list of permitted values, for example with the Design Control tags.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~CheckURLParam-TouchData(ansicht)~
~DC-FPansicht_set($CheckURLParam-Data$)~

{DC-FPansicht(liste)}<!-- Listenansicht -->{/DC-FPansicht(liste)}
{DC-FPansicht(kachel)}<!-- Kachelansicht -->{/DC-FPansicht(kachel)}
```

> [!NOTE]
>
> This is the usual pattern: read in the external value once, check it against the expected values, and only then do something. Anything that does not fit the list is silently ignored.

Reference: Design Control tags

## The tags at a glance

| Tag | Single tag | Area tag | Negative area tag | Loop tag |
| - | - | - | - | - |
| `CheckURLParam-TouchData()` | yes | – | – | – |
| `CheckURLParam-DataOK` | – | yes | yes | – |
| `CheckURLParam-Data` | yes | yes | yes | – |
| `CheckCookie-TouchData()` | yes | – | – | – |
| `CheckCookie-DataOK` | – | yes | yes | – |
| `CheckCookie-Data` | yes | yes | yes | – |

All six tags are permitted on all templates.

## Related topics

* Reference: Design Control tags
* Materials: Cookies used
* Guide: Tracking advertising success with Referer and SubReferer


## Related topics

- [DC- (cookie data)](https://dokumentation.websale.de/en/v8s/referenz/tags/dc/cookie-daten.md)
- [DC- (comparisons and other tags)](https://dokumentation.websale.de/en/v8s/referenz/tags/dc/vergleiche.md)
- [Data migration](https://dokumentation.websale.de/en/migration/daten-migration.md)
- [Materials: consent to data processing](https://dokumentation.websale.de/en/v8s/materialien/materialien-einwilligung-zur-datenverarbeitung.md)
- [$wsPayPalCheckout - PayPal](https://dokumentation.websale.de/en/frontend/referenz/module/wspaypalcheckout.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.