> For the complete documentation index, see [llms.txt](https://docs.barte.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.barte.com/api-reference/3ds/coletar-dados-do-navegador.md).

# Coletar dados do Navegador

#### <i class="fa-triangle-exclamation">:triangle-exclamation:</i> **Campos importantes:**

Esses campos utilizados no script são obtidos na criação da sessão 3DS.

* `collectUrl`: URL onde o navegador vai enviar dados de background.
* `token`: JWT usado no script de coleta.
* `id`: (setupId) — será enviado depois no pagamento.

#### **Objetivo:**

Antes de criar uma cobrança, é necessário coletar os dados do cliente. Para isso, é necessário incluir um script no front-end que fará essa coleta e enviará para o provedor 3DS. Existem 2 campos necessários para a coleta de dados, o **collectUrl** e o **token**. Esses campos são retornados na criação da sessão.

#### **Script de coleta:**

```html
<div style="display: none;">
  <iframe id="cardinal_collection_iframe" name="collectionIframe" height="1" width="1"></iframe>
  <form id="cardinal_collection_form" method="POST" target="collectionIframe">
    <input id="cardinal_collection_form_input" type="text" name="JWT" value="">
  </form>
</div>
<script>
  const collectUrl = '<collectUrl>';
  const token = '<token>';
  const docFormCardinal = document.getElementById('cardinal_collection_form');
  const docInputCardinal = document.getElementById('cardinal_collection_form_input');
  docFormCardinal.action = collectUrl;
  docInputCardinal.value = token;
  docFormCardinal.submit();
  window.addEventListener("message", function (event) {
    const origin = new URL(collectUrl).origin;
    if (event.origin === origin) {
      const data = JSON.parse(event.data);
      console.log('COLETA FINALIZADA:', data);
    }
  });
</script>

```

#### <i class="fa-triangle-exclamation">:triangle-exclamation:</i> **Observação:**

* O Seller precisa aguardar a finalização da coleta antes de prosseguir para a criação da cobrança.
* Coleta rápida (\~1s).


---

# 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.barte.com/api-reference/3ds/coletar-dados-do-navegador.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.
