> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nemu.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Framer

> How to connect Framer to Nemu Dashboard

## UTM Passing Script

### When to use

If you have a dedicated sales page, you need to install the UTM passing script on the Framer checkout page.

### Why it's important

The UTM passing script plays a crucial role in transferring UTM information from one page to another within your sales funnel, ensuring this data is tracked until the checkout moment.

```js UTM Passing Script theme={null}
<script>
   var timer = setInterval(function () {
      const location =
         window.trackingNemu?.nemuUtms ||
         new URL(document.location.href)?.searchParams;
      const fields = [
         "src",
         "sck",
         "utm_source",
         "utm_medium",
         "utm_campaign",
         "utm_content",
         "utm_term",
         "nemu_source",
         "nemu_medium",
         "nemu_campaign",
         "nemu_content",
         "nemu_adset",
         "nemu_term"
      ];
      var links = document.getElementsByTagName("a");

      for (var i = 0, n = links.length; i < n; i++) {
         if (links[i].href.includes("#")) continue;
         if (links[i].href) {
            let link = new URL(links[i].href);
            fields.forEach((field) => {
               if (location.get(field))
                  link.searchParams.set(field, location.get(field));
            });
            let href = link.href;
            links[i].href = href;
         }
      }
   }, 500);
</script>
```

### How to install

1. Access the settings of your page on Framer

2. In the **Custom Code** section, add the [UTM passing script](#utm-passing-script) and the [Nemu Pixel](/en/onboarding/configuring-pixel) (generated in [step 4 of onboarding](/en/onboarding/configuring-pixel#4-click-on-the-button-to-copy-the-generated-script))

<img src="https://mintcdn.com/nemu/w_LOeVHkZxi-c4ax/assets/pages/integracoes/framer/1.png?fit=max&auto=format&n=w_LOeVHkZxi-c4ax&q=85&s=ddcd2bf35fe087bd78286d9058ef6ea7" alt="" width="3024" height="1672" data-path="assets/pages/integracoes/framer/1.png" />

3. Click on **Save** to save the changes.

<Info>
  If your page contains forms before going to checkout, you need to install the UTM passing script on the form so that UTMs are captured.
</Info>

## UTM Passing Code on Framer Form

1. In the sidebar, in **Code** click on the **+** button and choose **New Code File**

<img src="https://mintcdn.com/nemu/w_LOeVHkZxi-c4ax/assets/pages/integracoes/framer/2.png?fit=max&auto=format&n=w_LOeVHkZxi-c4ax&q=85&s=2b190faef20efac098593827efea5005" alt="" width="654" height="1520" data-path="assets/pages/integracoes/framer/2.png" />

2. In the **Name** field, type **NemuHotmartForm**, choose the **Override** option and click on **Create**

<img src="https://mintcdn.com/nemu/w_LOeVHkZxi-c4ax/assets/pages/integracoes/framer/3.png?fit=max&auto=format&n=w_LOeVHkZxi-c4ax&q=85&s=fb61fedbd01461e68772b013c947fba4" alt="" width="456" height="370" data-path="assets/pages/integracoes/framer/3.png" />

3. Paste the code below into the created file:

<Warning>
  Replace the checkout URL with your offer's checkout URL and the form fields with your form fields.
</Warning>

<img src="https://mintcdn.com/nemu/w_LOeVHkZxi-c4ax/assets/pages/integracoes/framer/4.png?fit=max&auto=format&n=w_LOeVHkZxi-c4ax&q=85&s=56a5ecb2dba0896f4e8ce10c5d55a65b" alt="" width="2068" height="1708" data-path="assets/pages/integracoes/framer/4.png" />

<Tip>
  To check the form field names, access your project popup and click on the field you want to check the name.

  <img src="https://mintcdn.com/nemu/w_LOeVHkZxi-c4ax/assets/pages/integracoes/framer/5.png?fit=max&auto=format&n=w_LOeVHkZxi-c4ax&q=85&s=3158cb509b412cfe733286949e9ff50a" alt="" width="2394" height="1274" data-path="assets/pages/integracoes/framer/5.png" />
</Tip>

```jsx theme={null}
import { Override } from "framer"

export function NemuHotmartForm(): Override {
    return {
        onClick: async () => {
            const waitForForm = () =>
                new Promise<HTMLFormElement | null>((resolve) => {
                    const start = Date.now()
                    const interval = setInterval(() => {
                        const form = document.querySelector("form")
                        if (form) {
                            clearInterval(interval)
                            resolve(form)
                        } else if (Date.now() - start > 2000) {
                            clearInterval(interval)
                            resolve(null)
                        }
                    }, 50)
                })
            const form = await waitForForm()
            if (!form) return

            const params =
                window.trackingNemu?.nemuUtms ||
                new URLSearchParams(window.location.search)
            const fields = [
                "src",
                "sck",
                "utm_source",
                "utm_medium",
                "utm_campaign",
                "utm_content",
                "utm_term",
                "nemu_source",
                "nemu_medium",
                "nemu_campaign",
                "nemu_content",
                "nemu_adset",
                "nemu_term",

                // Add form fields
                "name",
                "email",
                "phone",
            ]

            fields.forEach((field) => {
                let input = form.querySelector<HTMLInputElement>(
                    `input[name='${field}']`
                )
                if (!input) {
                    input = document.createElement("input")
                    input.type = "hidden"
                    input.name = field
                    form.appendChild(input)
                }
                const val = params.get(field)
                if (val) input.value = val
            })

            const getValue = (name: string) =>
                form.querySelector<HTMLInputElement>(`input[name='${name}']`)
                    ?.value || ""

            // Replace with your offer's checkout URL
            const checkoutURL = "https://pay.hotmart.com/999999999?off=999999999&checkoutMode=10"

            const url = `${checkoutURL}&name=${encodeURIComponent(getValue("name"))}&email=${encodeURIComponent(getValue("email"))}&phoneac=${encodeURIComponent(getValue("phoneac"))}&src=${encodeURIComponent(getValue("src"))}&sck=${encodeURIComponent(getValue("sck"))}&utm_source=${encodeURIComponent(getValue("utm_source"))}&utm_medium=${encodeURIComponent(getValue("utm_medium"))}&utm_campaign=${encodeURIComponent(getValue("utm_campaign"))}&utm_content=${encodeURIComponent(getValue("utm_content"))}&utm_term=${encodeURIComponent(getValue("utm_term"))}`

            window.location.href = url
        },
    }
}
```

4. On your form button, select the component in **Code Override** and choose **NemuHotmartForm**

<img src="https://mintcdn.com/nemu/w_LOeVHkZxi-c4ax/assets/pages/integracoes/framer/6.png?fit=max&auto=format&n=w_LOeVHkZxi-c4ax&q=85&s=0d1aeeed78d095c6f202d2a9704e4fb2" alt="" width="2496" height="1528" data-path="assets/pages/integracoes/framer/6.png" />

5. Click on **Publish** and then **Update** to view the changes.

<img src="https://mintcdn.com/nemu/w_LOeVHkZxi-c4ax/assets/pages/integracoes/framer/7.png?fit=max&auto=format&n=w_LOeVHkZxi-c4ax&q=85&s=8c02a83269f294aecf8c757b4d3873ee" alt="" width="694" height="516" data-path="assets/pages/integracoes/framer/7.png" />
