# Start collecting data

The simplest way to start collecting data is by adding UserFlux to your website. It only takes a few minutes and will start auto capturing traffic along with location and device information about the user.

To get started, either copy the code snippet below or install the SDK:

{% tabs %}
{% tab title="Code Snippet" %}

```html
<head>
    <!-- Your other head tag code -->
    
    <script type="module" async>
    import UserFlux from 'https://cdn.skypack.dev/@userflux/browser-js-lite'
    UserFlux.initialize('<YOUR_WRITE_KEY>', {
	autoCapture: ['all'],
	allowCookies: true,
	autoEnrich: true,
	trackSession: true,
	defaultTrackingProperties: { project: 'Landing Page' }
    })
    </script>
</head>
```

Make sure to add the script to the end of your head tag and replace `<YOUR_WRITE_KEY>`  with your own API key
{% endtab %}

{% tab title="Install the SDK" %}

```sh
npm i @userflux/browser-js
```

```javascript
import UserFlux from '@userflux/browser-js'

UserFlux.initialize('<YOUR_WRITE_KEY>', { 
    autoCapture: ['all'],
    allowCookies: true,
    autoEnrich: true,
    trackSession: true,
    defaultTrackingProperties: { project: 'Web App' }
})
```

You can see the full list of SDK options from this link:

{% content-ref url="/pages/qvWI6OsBSca2hKkGk6n9" %}
[SDKs](/userflux-docs/sdks/browser-sdk.md)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}

***

This is all you need to do to start seeing some data come through into your workspace. When you're ready to add more data, you can checkout the Integration section to learn how to identify users and send custom events.

{% content-ref url="/pages/eYvyV3RiTdkecXQYLPFy" %}
[Integration](/userflux-docs/integration/identify-users.md)
{% endcontent-ref %}

To ensure you are using the correct API key please see the different types and environments in this page:

{% content-ref url="/pages/oUygvhygwH9tnVclaGwv" %}
[Environments and API Key Types](/userflux-docs/apis/environments-and-api-key-types.md)
{% endcontent-ref %}


---

# 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://userflux.gitbook.io/userflux-docs/start-collecting-data.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.
