# React

Integrate the Userlens SDK into your React application.

## Installation

```bash
npm install userlens-analytics-sdk
```

## Choose Your Setup

|                     | Client-Side Setup | Proxy Setup                        |
| ------------------- | ----------------- | ---------------------------------- |
| **Best for**        | Most applications | Apps needing ad blocker resistance |
| **Backend changes** | None              | Required                           |
| **Setup time**      | \~5 minutes       | \~15 minutes                       |

{% content-ref url="/pages/xkVDRfwb31QT0DHPoXQo" %}
[Client-Side Setup](/userlens-analytics/getting-started/react/client-side.md)
{% endcontent-ref %}

Events go directly from the browser to Userlens. Quick to set up, no backend changes needed.

{% content-ref url="/pages/BqBKKTsAmdDUQzGo7jew" %}
[Proxy Setup](/userlens-analytics/getting-started/react/proxy.md)
{% endcontent-ref %}

Events flow through your backend first. Use this if you need to avoid ad blockers.


---

# 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://userlens.gitbook.io/userlens-analytics/getting-started/react.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.
