---
title: hypeDocument.setCustomDataVariable
slug: hypedocumentsetcustomdatavariable
description: Learn how to use the `hypeDocument.setCustomDataVariable` function to store custom data variables in LRS notation. This comprehensive document explains the function's parameters, such as key and value, which can be a string, number, or boolean. Discover a
docTags: 
createdAt: 2022-05-04T12:13:23.000Z
---

The `hypeDocument.setCustomDataVariable` function is used to store custom data variables that can be used in the LRS notation. The function takes two parameters: the key of the custom data variable, and the value to be stored. The value can be either a string, number, or boolean. If the value is a string, it will be stored as-is. If the value is a number, it will be stored as a floating-point number. If the value is a boolean, it will be stored as either true or false.&#x20;

An example of using the `hypeDocument.setCustomDataVariable` function would be as follows:

```javascript
hypeDocument.setCustomDataVariable("userID", "User123456");
hypeDocument.setCustomDataVariable("userAge", "21");
hypeDocument.setCustomDataVariable("userIsRegistered", "true");
```

In this example, we are setting three custom data variables: `userID`, `userAge`, and `userIsRegistered`. The `userID` variable is being set to a string value of `"User123456"`, the userAge variable is being set to a number value of `21`, and the `userIsRegistered` variable is being set to a boolean value of `true`.

:::hint{type="danger"}
Hence, be aware that there is some **variable** **casting**  going on when using the `hypeDocuemt.etCustomDataVariable` function. This function exists to provide the GUI version and mirror the functionality in code.
:::

If you mainly use Hype custom data you can also use `hypeDocument.customData` directly:

```javascript
hypeDocument.customData.userID = "User123456";
hypeDocument.customData.userAge = 21;
hypeDocument.customData.userIsRegistered = true;
```



