# Referral Tracking

MetaVault deposits can include **additional parameters embedded directly in the onchain transaction**, enabling reliable attribution and access control without relying on offchain tracking.

#### Deposit Parameters

Two optional fields may be provided during deposit:

**`assets`** - the quantity of tokens being deposited, expressed in the token’s smallest unit.\
For example, a deposit of **1 wstETH** is represented as **`1e18`**.

**`referral`** - a tracking code used to attribute the source of the deposit (e.g., partner, campaign, or distribution channel).

**`merkleProof`** - a proof used to validate **whitelisted deposits**, ensuring that only approved addresses or allocations can participate when whitelist restrictions are enabled.

These parameters are written directly into the deposit queue contract and become part of the onchain record for the transaction.

For the exact implementation and parameter structure, see the contract source:

**DepositQueue.sol**\
<https://github.com/mellow-finance/flexible-vaults/blob/main/src/queues/DepositQueue.sol#L64>

#### Recommended Integration Approach

For accurate attribution, it is **strongly recommended to use a custom UI or integration layer** that:

* Injects the correct referral code into the deposit transaction
* Ensures parameters are consistently formatted and recorded onchain

Because the data is embedded in the transaction itself, this method provides deterministic and verifiable attribution.

### How to integrate the referral address

You can set up referral attribution by sharing a **vault link with a personalized web parameter** that includes your wallet address as the referral ID.

#### How to use it

1. **Copy your wallet address**\
   This address acts as your unique referral identifier.<br>
2. **Add it to the vault link**\
   Attach the following parameter to the URL:

   ```
   ?referral=YOUR_WALLET_ADDRESS
   ```

   \
   **Example:**

   ```
   https://app.mellow.finance/vaults/earneth?referral=0xAbC123...
   ```
3. **Share the link**\
   When someone opens your link and deposits through the interface,\
   your wallet address is recorded onchain as the referral source.

#### Limitations of URL-Based Referrals

Web referrals passed via URL parameters (e.g., `?referral={code}`) are technically possible but **not fully reliable in the crypto space**.

Many users interact through:

* Privacy-focused browsers
* Wallet in-app browsers
* Direct contract interactions

These flows often **strip or ignore URL query parameters**, leading to incomplete or incorrect attribution.


---

# 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://metavaults.mellow.finance/referral-tracking.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.
