> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://ajuda.greatsoftwares.com.br/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to CONVERT VARIABLES sent in a form to HOTMART

 To convert the data submitted by a lead on the conversion page into automatic fill-in on a thank you page, follow the tutorial below.

|| The first step is to **create and publish both pages** (conversion page and thank you page). Once both are ready, you can follow the next instructions.

###### Settings on the conversion page

1. Access the page editor and click on **"Edit"** in the form editing options;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_1qh97ht.png)

2. When you do this, the Settings menu will open on the right side of the screen.

In the **"Redirecionar para"** field, add the link of your thank you page to unlock the form's advanced settings. Then click on **"Settings advanced"**;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_1t0zd4m.png)

3. After that, a box will open on the screen where you need to enable sending the form data in the redirect;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_kvbdlj.png)

4. Next, the form variable settings will open.

In the fields where you enter the variables, they must be written without spaces or special characters, just like in the example below;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_16ul4s1.png)

5. Finally, click on **"Salvar"** and move on to the next configuration step.

Oh, and don't forget to update your page so these changes are sent to the published page.

###### Settings on the thank you page

1. Access the page editor and **add to the page text** (where you want the data conversion to happen) **exactly the same variable** you configured in the form on the conversion page.

|| The variable must be between curly braces "{}" and exactly the same as the one configured on the conversion page.

![](https://storage.crisp.chat/users/helpdesk/website/a6ab90d8350d6000/pagina-6png_wbv2py.png)

2. Next, click on the **gear icon** in the top right corner of the screen;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/click-ingre_1xrgkah.png)

3. Click on **"Javascript & CSS"**;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/clickjavacss_12lkan6.png =784xauto)

4. Click to **"Adicionar código"**;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_179ddqc.png)

5. A box will then open where you will need to add the name of your code, select the **"Funcionamento"** option and add all of the code below to the **"Código"** field (just like in the example). This code is what makes the variable inserted on the page be replaced by the lead's data;

```
<script>
/\* Função para pegar os parametros na url \*/
function URLToArray (url){
    var request = {};
    if(url.indexOf('?') !== -1){
        var pairs = url.substring(url.indexOf('?') + 1).split('&');
        for (var i = 0; i < pairs.length; i++) {
            if (!pairs[i]) continue;
            var pair = pairs[i].split('=');
            request[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
        }
    }
    return request;
}
/\* Função para atualizar os dados em elementos \*/
function AtualizarInformacoes(limpar){
    if(limpar == undefined){ limpar = false;}
    var dados = Object.entries(URLToArray(window.location.href)), total\_dados = 0;
    if(dados.length == 0 || limpar){
        dados = {'(.\*?)':''};
        dados = Object.entries(dados);
    }
    total\_dados = dados.length;
    if(total\_dados){
        var elementos = document.getElementsByClassName('gpc-e');
        if(elementos){
            var total = elementos.length;
            for (var i = 0; i < total; i++) {
                if(elementos[i].classList.contains('e\_formulario')){
                    var campos = elementos[i].getElementsByTagName('INPUT'), total\_campos = 0;
                    total\_campos = campos.length;
                    if(campos.length){
                        for (var y = 0; y < total\_campos; y++) {
                            var valor = campos[y].value;
                            if(valor){
                                for (var x = 0; x < total\_dados; x++) {
                                    var regex = new RegExp('{'+dados[x][0]+'}', 'gm');
                                    valor = valor.replace(regex,dados[x][1]);
                                }
                                campos[y].value = valor;
                            }
                        }
                    }
                    var campos = elementos[i].querySelectorAll('.gpc\_campos-titulo, .gpc\_campos-texto'), total\_campos = 0;
                    total\_campos = campos.length;
                    if(campos.length){
                        for (var y = 0; y < total\_campos; y++) {
                            var conteudo = campos[y].innerHTML;
                            if(conteudo){
                                for (var x = 0; x < total\_dados; x++) {
                                    var regex = new RegExp('{'+dados[x][0]+'}', 'gm');
                                    conteudo = conteudo.replace(regex,dados[x][1]);
                                }
                                campos[y].innerHTML = conteudo;
                            }
                        }
                    }
                } else if(elementos[i].classList.contains('e\_faq')){
                    var campos = elementos[i].querySelectorAll('.gac-item\_cabecalho\_titulo, .gac-item\_conteudo'), total\_campos = 0;
                    total\_campos = campos.length;
                    if(campos.length){
                        for (var y = 0; y < total\_campos; y++) {
                            var conteudo = campos[y].innerHTML;
                            if(conteudo){
                                for (var x = 0; x < total\_dados; x++) {
                                    var regex = new RegExp('{'+dados[x][0]+'}', 'gm');
                                    conteudo = conteudo.replace(regex,dados[x][1]);
                                }
                                campos[y].innerHTML = conteudo;
                            }
                        }
                    }
                } else if(elementos[i].classList.contains('e\_botao') || elementos[i].classList.contains('e\_imagem') || elementos[i].classList.contains('e\_icone') || elementos[i].classList.contains('e\_texto') || elementos[i].classList.contains('e\_titulo') || elementos[i].classList.contains('e\_html')){
                    var conteudo = elementos[i].innerHTML;
                    for (var x = 0; x < total\_dados; x++) {
                        var regex = new RegExp('{'+dados[x][0]+'}', 'gm');
                        conteudo = conteudo.replace(regex,dados[x][1]);
                    }
                    elementos[i].innerHTML = conteudo;
                }
            }
        }
    }
    if(!limpar){AtualizarInformacoes(true); }
}
AtualizarInformacoes();
$('body').on('click','.link\_popup',function(){ setTimeout(function(){ AtualizarInformacoes(); },100); });
</script>
```

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_viwhso.png =276xauto)

6. Finally, don't forget to click **"To update"** on your page so the changes are sent to the published page.

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_ioo43s.png)

Did you like this article? If you need any help, reach out to our support team. We're always happy to help! :)  