> ## 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 create a random REDIRECT to WHATSAPP GROUPS

To install the **random code to redirect to WhatsApp groups**, follow the tutorial below:

1. Create a new page that will contain only a message letting the visitor know they will be redirected to a WhatsApp group (e.g.: Please wait, you are being redirected to a WhatsApp group...);

2. After creating the visual part of the page, click the **gear icon** in the upper right corner of the page editor;

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

3. Go to **"Javascript & CSS"**;

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

4. Click **"Add code"**, add a name for your code, select the code type as **"Functionality"** and add the code below in the text field:

```
<script>
var urls = new Array();
urls[0] = "https://link1.com/";
urls[1] = "https://link2.com/";
urls[2] = "https://link3.com/";
urls[3] = "https://link4.com/";
var random = Math.floor(Math.random()\*urls.length);
window.location = urls[random];
</script>
```

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

5. The only change you will need to make to this code is in the **URLs**.

Where it says https://link1.com/, https://link2.com/ and so on, you will need to **replace them with your group links**.

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

A practical example would look like the code below once installed.

```
<script>
var urls = new Array();
urls[0] = "https://grupo1.com/";
urls[1] = "https://grupo2.com/";
var random = Math.floor(Math.random()\*urls.length);
window.location = urls[random];
</script>
```

6. Click **"Add"**!

7. After finishing the code installation, **publish** this redirect page.

If you don't know how to publish a page, see this tutorial -> https://ajuda.greatsoftwares.com.br/pt-br/article/como-publicar-uma-pagina-11vhkbn/

8. After publishing, copy the URL of the published page and add it to your form's **redirect link**.

If you don't know how to do it, follow this tutorial -> https://ajuda.greatsoftwares.com.br/pt-br/article/como-redirecionar-um-lead-apos-o-envio-do-formulario-1d24y0d/

All set! After that, your random redirect to WhatsApp groups will be ready.

We hope this helped! If you have any questions, get in touch with our team. :)  