> For the complete documentation index, see [llms.txt](https://docs.saas.haut.ai/haut.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.saas.haut.ai/haut.ai/haut.ai-features/consumer-apps/specify-the-user-for-consumer-app-by-providing-an-external-user-id.md).

# Specify the User for Consumer App by providing an external user ID

This page explains how you can pass your external user IDs to the Consumer App and link them with Haut.AI's user names in the Consumer App

{% hint style="info" %}
Haut.AI has a concept of `subject` to store and process data separately for different real users. You can read more about subjects here: [Subjects](/haut.ai/haut.ai-features/datasets/subjects.md)
{% endhint %}

## Option 1: Automatic User Detection by Haut.AI

By default, the [Consumer Apps](/haut.ai/haut.ai-features/consumer-apps.md) identifies the user automatically by **device + browser fingerprint**.

* **New User:** When a new fingerprint is identified, a new subject will be created. The subject will be assigned an automatically generated internal ID -`subject_ID`;
* **Existing User:** When the same device + browser fingerprint is used to access the [Consumer Apps](/haut.ai/haut.ai-features/consumer-apps.md) again (read: *same user returned to the app*), the [Consumer Apps](/haut.ai/haut.ai-features/consumer-apps.md) will automatically identify the already existing subject.

**When is this option applicable?**

* If your product (website or mobile application) has no authentication feature.
* If your product has an authentication feature, but your users can access the Consumer App without it (for example, the Consumer App is a part of the lead generation funnel, leading to the registration page)

***

## Option 2: Define User via External User ID passing

You can optionally pass your external user IDs to the Consumer App's `name` parameter.

* **New User:** When you pass an external user ID as a `name` that does not yet exist in SaaS, a new subject will be created. The subject will be assigned an automatically generated internal ID -`subject_ID`, — and a `name` equal to your external user ID;
* **Existing User:** When you pass an external user ID as a `name` that already exists in the SaaS, the [Consumer Apps](/haut.ai/haut.ai-features/consumer-apps.md) will use the existing subject.

**When it is applicable**

* If your product has an authentication feature, and users are assigned user IDs, and the Consumer App experience starts after your user logins to your system.

**Benefits**

By linking your external user IDs with Haut.AI's `name` parameter, you will:

* Enable better tracking of users, especially in multi-tenant applications.
* Enhance the ability to better segment and analyze user behavior (for example, compare the behavior of users who did and did not use Consumer App).

***

### Create personalized links by adding an External User ID

Each Consumer App has a unique URL that allows you to open it as a separate webpage or integrate it (see [Integrate Consumer App to your e-Commerce Website](/haut.ai/quick-start-guides/no-code-app-for-e-commerce-businesses/integrate-consumer-app-to-your-e-commerce-website.md)). You can find the link here: [Create a Consumer App](/haut.ai/quick-start-guides/no-code-app-for-e-commerce-businesses/create-consumer-app.md#previewing-your-consumer-app).

The URL has the following format:

<pre data-overflow="wrap"><code><strong>https://saas.haut.ai/b2c/first-entrance?app_id=&#x3C;app_id>&#x26;company_id=&#x3C;company_id>&#x26;utm_campaign=&#x3C;campaign_name>&#x26;company_cid=&#x3C;company_code>
</strong></code></pre>

<details>

<summary>What does each parameter in URL mean?</summary>

* **app\_id**: The unique identifier for your [Consumer Apps](/haut.ai/haut.ai-features/consumer-apps.md). <mark style="color:red;">Never change this parameter.</mark>
* **company\_id**: The identifier of your company within Haut.AI SaaS. <mark style="color:red;">Never change this parameter.</mark>
* **company\_cid**: A client identification number of your company. <mark style="color:red;">Never change this parameter.</mark>
* **utm\_campaign**: Used for tracking the campaign that led the user to the app. <mark style="color:green;">This parameter is optional — you can change it to label different channels, or remove it entirely.</mark>

</details>

```
&name=<external_user_id>
```

{% hint style="warning" %}
external\_user\_id must be a string (simple text) with a max length of 512 symbols
{% endhint %}

#### Example

> Let's say your user has a user ID in your system as `User123`. When correctly implemented, your URL for your [Consumer Apps](/haut.ai/haut.ai-features/consumer-apps.md) should look like this:

{% code overflow="wrap" %}

```
https://saas.haut.ai/b2c/first-entrance?app_id=<app_id>&company_id=<company_id>&utm_campaign=<campaign_name>&company_cid=<company_code>&name=User123
```

{% endcode %}

### Recommendations for Implementation (for Developers)

* Your frontend application should be configured to inject parameter `name` to the URL in the iframe when the user accesses the application. Typically, this is done in the app's initialization code.
* Validate the incoming query parameters to prevent potential security vulnerabilities, such as injection attacks.

***

### Find External User ID in Haut.AI SaaS

When the user that is identified via an external user ID (`&name=<external_user_id>`) finishes the Consumer App session, you will see in SaaS a new [Subjects](/haut.ai/haut.ai-features/datasets/subjects.md). This subject will have:

* **Subject ID**: Haut.AI internal user ID, generated automatically.
* **Name**: your \<external\_user\_id> user will be here.

You will be able to see External User ID in the SaaS User Interface on a page of [Datasets](/haut.ai/haut.ai-features/datasets.md) > [Subjects](/haut.ai/haut.ai-features/datasets/subjects.md)

<figure><img src="https://245161714-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWxBX_zB4FnflOpyBGO%2Fuploads%2FRGLfcd1nqdeK7h5fRYe5%2FScreenshot%202025-01-24%20at%2009.48.39.png?alt=media&amp;token=933d89e6-b6ca-45be-a9d2-958ca16f2284" alt=""><figcaption><p>External User ID visible in SaaS UI</p></figcaption></figure>

You will also be able to export this information via CSV export from Dataset (see [Export Results as CSV file](/haut.ai/haut.ai-features/datasets/csv-file-with-raw-statistics.md)):

<figure><img src="https://245161714-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWxBX_zB4FnflOpyBGO%2Fuploads%2F1D1aV3I2G7vhuh5yGKqF%2FSubject%20Name.jpg?alt=media&amp;token=104e5a23-caa9-4381-85b6-e811a27d6875" alt=""><figcaption><p>External User ID present in CSV Export</p></figcaption></figure>

***

{% hint style="warning" %}
Not a Haut.AI client yet?
{% endhint %}

<a href="https://haut.ai/book-a-demo?utm_source=referral&#x26;utm_medium=saas_docs&#x26;utm_campaign=Docs_SaaS_HautAI" class="button primary" data-icon="user-vneck">Book a demo</a> <a href="https://haut.ai/product/ai-skin-analysis?utm_source=referral&#x26;utm_medium=saas_docs&#x26;utm_campaign=Docs_SaaS_HautAI" class="button secondary" data-icon="external-link">Platform overview on haut.ai</a>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.saas.haut.ai/haut.ai/haut.ai-features/consumer-apps/specify-the-user-for-consumer-app-by-providing-an-external-user-id.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
