# Examples

Easily integrate the HUDI SDK by copying and pasting the provided code into your website’s head tag. Interact with users' Data Wallets through methods for writing, reading, and managing data securely within the HUDI ecosystem.

Follow practical examples to understand how to write, read, and interact with data within the HUDI ecosystem. These examples provide step-by-step guidance to help you integrate HUDI's Data Wallet into your applications, ensuring secure data transactions.

## Setup

First of all the SDK setup, just copy and paste this code in your website ***head*** tag. That's it.

```typescript
<script>
! function(h, u, d, i) {
        i = h.document.createElement(d);
        i.async = !0;
        i.src = 'https://asset.humandataincome.com/sdk/index.js';

        u.getElementsByTagName(d)[0].parentNode.prepend(i);

        for (let j of ['hdw', 'hdr', 'hdn', 'hdl']) {
          if (!h[j]) {
            h[j] = (a) => h[j].m ? h[j].m(a) : h[j].q.push(a);
            h[j].q = []
          }
        }
      }(window, document, 'script');
</script>
```

Now you can interact with the visitor user data wallet with three methods that will be discussed now.&#x20;

## Write

```typescript
window.hdw({
 data: [
   {
     path: 'profile.personal',
     value: {
       firstName: 'John',
       lastName: 'Doe',
       email: 'johndoe@humandataincome.com'
     }
   },
   {
     path: 'profile.demographic',
     value: {
       career: 'Engineer',
     }
   }
 ],
 dismiss: () => {}
})
```

## Read

In order to read from the user data wallet you can invoke this method.

```typescript
window.hdr({
  data: [
    {
      path: 'app#humandataincome#com.profile.personal',
      required: false,
    },
    {
      path: 'app#humandataincome#com.profile.demographic',
    },
  ],
  dismiss: () => {},
  response: (data) => {
    console.log('response', data);
  }
})
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.humandataincome.com/datamask/for-developers/examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
