Skip to main content

UTM forwarding script

When to use

If you have a landing page (sales page, capture page, or any intermediate page) that directs the visitor to the checkout, you need to install the UTM forwarding script on that page. It is generic and works on any page that allows you to insert HTML/JavaScript code, including pages created in AI-powered no-code builders, such as:
  • Lovable
  • Base44
  • Bolt
  • v0
  • Replit
  • Any other builder that generates pages with its own code
If your platform already has a specific guide (such as Framer, WordPress, Hotmart or Inlead), follow its dedicated guide. Use this page only for generic pages or builders without their own integration.

Why it’s important

The UTM forwarding 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. Without the script, when clicking a button or link on your landing page, the tracking parameters (UTMs) are lost and the sale is not attributed correctly to the source campaign.

How to install

  1. Access the editor or settings of your landing page
  2. Locate the option to insert custom code (usually called Custom Code, Head, Embed, HTML or Scripts)
  3. Add the script below in the page’s <head> tag (or in the header code field)
  4. Save and publish the changes
UTM forwarding script
<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>

Tracked parameters

The script automatically captures the following UTM parameters and forwards them to the page’s links:
  • src - Traffic source
  • sck - Custom tracking key
  • utm_source - Campaign source
  • utm_medium - Marketing medium
  • utm_campaign - Campaign name
  • utm_content - Specific content
  • utm_term - Search terms
Tip: The script runs automatically every 500ms, updating all of the page’s links (<a href>) with the captured UTMs. This way, when clicking a button that leads to the checkout, the parameters are forwarded correctly.

Things to watch out for in no-code builders

  • Make sure the button that leads to the checkout is a real link (<a href>) pointing to the checkout URL. Buttons that only use click events without an href do not receive the UTMs automatically.
  • On platforms like Lovable and Base44, insert the script in the header code field (<head>) or in an HTML/Embed component on the page.
  • Don’t forget to also install the Nemu Pixel on the same page for complete tracking.
After installing and publishing, open your landing page with UTM parameters in the URL (e.g., ?utm_source=test&utm_campaign=test) and click the checkout button. Check whether the UTMs appear in the checkout URL to confirm that the script is working.