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.
- Page loadsSame script URL requested twice
- Script runs twiceEvent handlers attached two times
- Visitor clicks SubmitHandler fires twice, form errors or posts twice
- Lead arrivesMissing or duplicated
The second copy runs the same code again, so the form handler fires twice and the submit fails.
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
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.
Filter to scripts and reload
Tick Disable cache, click the JS filter, then reload the page so every request is listed.
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.
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.Run a console check
Paste the snippet below into the Console to list any script URL included more than once in the HTML.
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.
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.
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).
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.
Use enqueue properly
In custom code, load scripts with wp_enqueue_script and a fixed handle. WordPress then loads each handle once.
Search the theme
Go to Online Store > Themes > Edit code and search for the file name in theme.liquid and the sections folder.
Remove the duplicate include
Keep one script_tag or asset_url line. Remove the other, or the snippet that repeats it.
Check apps
Open Online Store > Themes > Customize > App embeds and switch off an app that loads the same library you already include. Uninstalled apps can leave code behind in theme files.
Look for a Custom HTML tag
In Tags, search for the script URL. A Custom HTML tag that loads a file already in your page is a common duplicate.
Remove or pause one
Pause the GTM tag or delete the hard-coded one in the site, not both.
Check triggers
If a tag fires on both All Pages and a page view event, change the triggers so it fires once.
Preview
Use Preview mode and confirm the tag appears once in the summary.
Check project-level code
Open Project settings > Custom code and look at Head and Footer code for the script.
Check page-level code
Open the page settings and any Embed elements on the page. Remove repeats so the script is added in one place only.
Check funnel and page tracking code
In the funnel settings, look at the Head and Footer tracking code, then at each step's own custom code.
Remove repeats
Keep the script in the funnel-level code only if every step needs it. Delete the same line from custom code elements on the page.
Check Custom Code
In Settings > Custom Code, look for the script added more than once, or applied to All pages and again to a single page.
Check embeds
Open HTML embed elements on the page and remove any that load the same file.
Check Code Injection
In Settings > Advanced > Code Injection, look in Header and Footer for the script.
Check page-level injection
Open the page settings > Advanced and any Code blocks on the page, and remove repeats.
Find the includes
Run a search across templates and partials: grep -rn "slider.js" ./src
Move to one shared layout
Put the script tag in the base layout only, not in each partial or component.
Dedupe bundles
If a bundler is used, check that one library is not pulled into two bundles. Mark it as external or share a chunk.
How to confirm it's fixed
- 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.
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
- 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.
Related issues
- PRF-088Duplicate tags (GA4 or Pixel loaded twice) adding weight and double hitsFix guide
- PRF-082Unminified JS/CSSFix guide
- PRF-083Third-party scripts make up over half the page weightFix guide
- PRF-078More than 150 requests on one pageFix guide
- PRF-080Several full icon font libraries loaded (Font Awesome x2)Fix guide
- PRF-077Page weight jumped after a change (new unoptimised asset)Fix guide