Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Duplicate script loaded twice (same URL): how to find and fix it

PRF-087Medium impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

A script is a JavaScript file the browser downloads and runs. A duplicate script is one that your page asks for twice using the same URL, for example two <script src="/js/slider.js"> tags, or the same library added by both your theme and a plugin.

The second request is often served from the browser cache, so it can look cheap. But the browser still has to run the file again. Many scripts are not built to run twice, so they attach their behaviour two times.

Common causes: a theme and a plugin both loading jQuery or a slider library; a snippet pasted into the page and also added through a tag manager; a page builder block that repeats an embed code on every section; and an old install code left behind after a migration.

Why it costs you leads or sales

The cost is usually indirect, which is why it gets missed. Extra downloads and extra execution make the page slower to become usable, mostly on mid-range phones and slow connections. Slow pages lose visitors before they reach the form or the buy button.

Running twice can also break things you can see. A form script that binds twice may submit the form two times. A popup script may open two overlays. A click handler may toggle a menu open and straight shut again. Any of these can quietly stop a lead or an order.

How a double-loaded script hurts the journey
  1. Page loadsSame script URL requested twice
  2. Script runs twiceEvent handlers attached two times
  3. Visitor clicks SubmitHandler fires twice, form errors or posts twice
  4. Lead arrivesMissing or duplicated

The second copy runs the same code again, so the form handler fires twice and the submit fails.

Page weight added by duplicatesExample numbers
Page weight added by duplicates (example)Needed scripts: 130 KB; Extra duplicate copies: 130 KB050100130130Needed scriptsExtra duplicate copiesKB

Example: a page loads a 90 KB library twice and a 40 KB slider twice. Figures are illustrative, not measured.

How to check if your site has it

Find duplicate script requests in Chrome DevTools
  1. Open the page and DevTools

    Open the landing page in a private window. Press F12 (or Cmd+Option+I on Mac) and choose the Network tab.

  2. Filter to scripts and reload

    Tick Disable cache, click the JS filter, then reload the page so every request is listed.

  3. Sort by name

    Click the Name column. Identical file names sit next to each other. Look for the same full URL (including the ?ver= part) appearing twice.

  4. Search the source

    Open View Source and search for the file name. Note how many <script> tags point to it and where each one sits.

  5. Run a console check

    Paste the snippet below into the Console to list any script URL included more than once in the HTML.

List script URLs that appear more than oncejavascript
const seen = {};
document.querySelectorAll('script[src]').forEach(s => {
  const u = s.src;
  seen[u] = (seen[u] || 0) + 1;
});
console.table(Object.entries(seen).filter(([u, n]) => n > 1));

How to fix it

The goal is to keep one copy and remove the others at the place that adds them. Deleting the tag from the rendered page will not work, because it will return on the next load. First work out who adds each copy, then pick the platform below.

Remove the extra copy by platform
  1. Find the source

    In View Source, check the file path. /wp-content/plugins/NAME/ points to a plugin, /wp-content/themes/NAME/ to your theme.

  2. Disable one source

    Deactivate the suspect plugin briefly, or turn off its option to load the library (many sliders and form plugins have a setting to skip loading jQuery or the library).

  3. Check hard-coded tags

    Look in Appearance > Theme File Editor (header.php, footer.php) and any header/footer injection plugin for a pasted copy of the same script.

  4. Use enqueue properly

    In custom code, load scripts with wp_enqueue_script and a fixed handle. WordPress then loads each handle once.

How to confirm it's fixed

Confirmation checks
  • Reload with Disable cache ticked: the script URL appears once in the Network tab.
  • The console snippet above returns an empty table.
  • The Console shows no new red errors.
  • Submit your lead form once and confirm exactly one entry arrives.
  • Test the menu, popups and sliders on a phone-size screen.
  • Repeat on the real landing page URL with its UTM or ad parameters.
Network tab before and after

Before

  • slider.js requested twice
  • Handlers attached twice
  • Form sometimes submits twice or fails

After

  • slider.js requested once
  • Handlers attached once
  • One submit, one lead

How to prevent it happening again

Habits that stop duplicates
  • Keep a list of every script and where it is added (theme, plugin, tag manager).
  • Add each script in one place only.
  • Before pasting a vendor snippet, search your site and tag manager for it.
  • Remove leftover code when you uninstall an app or plugin.
  • Re-run the Network tab check after every theme, plugin or tag change.
  • Use a staging site for changes to header and footer code.

How FunnelGuard handles this

FunnelGuard does not check for duplicate script loads yet. It is a possible future check, so do not rely on it for this today.

What FunnelGuard does do is run your real customer journeys on a schedule (lead forms, checkouts, booking and chat buttons) and check each step, the tracking hits sent to ad and analytics platforms, and whether test leads reach your inbox and CRM. If a double-running script breaks a form or stops a button working, the journey fails and you get an alert with a screenshot and a likely cause. That tells you the effect, not that a duplicate script is the reason.

To watch for duplicates yourself, repeat the DevTools check after each site change. You can also run a free tool such as Lighthouse in Chrome DevTools, which includes a Performance audit, and compare the request list each time. FunnelGuard also offers a free read-only website audit, and the Free plan covers 1 site and 2 journeys with daily checks, no card needed.

Frequently asked questions

See the questions below for quick answers.

Questions people ask

Why is my script loading twice on my website?

Usually two sources add it: for example your theme and a plugin, or a pasted snippet and a tag manager tag. Check the file path in View Source to see which source each copy comes from, then remove one.

How do I find duplicate scripts on a page?

Open DevTools, go to the Network tab, filter by JS, reload and sort by name. The same URL listed twice is a duplicate. You can also run a short console snippet that counts script src values.

Does loading the same script twice slow down my site?

Yes, it can. Even if the second download comes from cache, the browser still has to parse and run it again. The effect is bigger on mobile devices and slow connections.

Can a duplicate script break my contact form?

Yes. If a form script attaches its handler twice, a single click can trigger two submits or an error. Test one submission after removing the extra copy and check that only one entry arrives.

How do I remove a duplicate jQuery in WordPress?

Find which plugin or theme file loads the second copy, then turn off that plugin's option to load jQuery or remove the hard-coded tag. Test your forms and sliders afterwards, since some plugins depend on a specific version.

Is a duplicate script the same as a duplicate tracking tag?

Not quite. A duplicate script is any file loaded twice. A duplicate tracking tag, like GA4 or a Meta Pixel, also double-counts events and conversions, so it needs its own check.

Does FunnelGuard detect duplicate scripts?

No, not yet. It is a possible future check. FunnelGuard does run your real journeys and would alert you if a form or button broke as a result, but it will not name a duplicate script as the cause.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.