On this page
What this issue is
Your pages load JavaScript from other domains: old analytics, a retired widget, a dropped A/B testing tool, a CDN link from a past redesign. If the owner of that domain stops paying, the domain expires and anyone can buy it. The new owner controls what the old URL returns.
Your page still contains <script src="https://old-tool.example/widget.js">. Browsers run whatever that URL returns, with the same rights as your own code. This is a supply chain attack: the weak link is not your server but a forgotten dependency.
Why it costs you leads or sales
The attacker's code can quietly copy form submissions, swap your phone number or payment link, redirect mobile visitors to scam pages, or show fake pop-ups. You may see conversions fall with no error on your side. Browsers and Google Safe Browsing can also flag your site as unsafe, which scares off visitors and ad platforms.
There are also legal costs. If personal data or card details leak through a script you chose to load, you may have to report a breach and answer to customers.
- Old script tag staysLeft in the theme or tag manager
- Vendor domain expiresNobody notices
- Attacker registers itServes malicious JS
- Visitor loads your pageScript runs with full access
- Lead or payment divertedData copied or redirected
The break happens outside your site, so nothing looks wrong in your own code.
How to check if your site has it
List every external script domain
Open your key pages (home, landing pages, checkout, thank-you) in Chrome, open DevTools, go to the Network tab, filter by JS and reload. Note every domain that is not yours. Also check the Sources tab, which groups files by domain.
Search your source code too
Scripts that only load on some pages or after consent may not show up at first. View the page source, your theme files and the tag manager containers, and search for
src=andhttps://.Check each domain's status
Look each domain up with a WHOIS or RDAP lookup tool. Note the registrar, creation date and expiry date. A creation date that is very recent for a tool you have used for years is a red flag.
Test whether the URL still works
Open the script URL in a browser tab. A 404 or a DNS error means the tool is probably dead. Content you do not recognise, or code that looks scrambled, is a warning sign.
Match each script to a purpose
Ask who added it and why. If nobody can say, treat it as a candidate for removal.
How to fix it
Decide for each risky domain: remove it, replace it, or self-host a reviewed copy. If you suspect an attacker already controls it, remove it first and investigate afterwards.
Find where it is added
Search theme files (header.php, footer.php, functions.php) and plugin settings for the domain. Check Appearance > Theme File Editor and any header/footer injection plugin.
Remove or deactivate
Delete the tag, or deactivate the plugin that adds it. Clear caching plugins and any CDN cache.
Search the theme
In Online Store > Themes > Edit code, search for the domain in theme.liquid and other templates.
Check apps and checkout
Review Settings > Apps and sales channels, and Settings > Customer events for old custom pixels. Uninstall unused apps and remove leftover code.
Search the container
Use the search in the workspace for the domain. Look in Custom HTML tags and templates.
Pause, then delete
Pause the tag, preview, publish, and delete it once nothing breaks. Review the version history for who added it.
Check custom code
Look in Site settings > Custom code (head and footer) and in each page's settings for custom code and embeds.
Remove and publish
Delete the script tag and publish the site.
Check tracking code areas
Review the funnel or website settings for header and footer tracking code, and custom code elements on individual pages.
Remove and republish
Delete the old script and save and publish each affected funnel or page.
Review custom code
Go to Settings > Custom Code and look for old snippets. Also check embedded HTML elements on pages.
Delete and publish
Remove the snippet and publish the site.
Check code injection
Open Settings > Developer Tools > Code Injection and check header, footer and any page-level injection or code blocks.
Remove and save
Delete the tag and save.
Search the codebase
Use a project-wide search for the domain, including templates, build config and CMS fields.
Remove or self-host
Delete the reference, or download a reviewed copy of the file and serve it from your own domain or controlled storage.
Self-host critical scripts
For libraries you must keep, host a reviewed copy yourself so a domain change cannot alter it.
Add Subresource Integrity where possible
For fixed, versioned files, add an integrity hash so the browser refuses a changed file. It does not work for scripts that change often.
Set a Content Security Policy
Allow scripts only from domains you list. Start in report-only mode to see what breaks.
Replace dead vendors
If the tool is still needed, switch to its current supplier and update the tag.
<script src="https://cdn.example.com/lib/1.2.3/lib.min.js"
integrity="sha384-REPLACE_WITH_REAL_HASH"
crossorigin="anonymous"></script>Content-Security-Policy-Report-Only: script-src 'self' https://www.googletagmanager.com https://www.google-analytics.com; report-uri /csp-reportBefore
- Old tags from past tools still in the theme
- No one knows who owns each domain
- Any domain can serve code to visitors
After
- Only needed scripts remain
- Critical files self-hosted or integrity-pinned
- CSP limits scripts to a short allowlist
How to confirm it's fixed
- Reload key pages with DevTools Network open and confirm the old domain no longer appears
- Search the page source and tag manager for the domain: no results
- Check the live site in a private window after clearing caches
- Confirm forms, checkout and tracking still work
- Review CSP reports for blocked or unexpected domains
How to prevent it happening again
- Keep a script inventory with owner, purpose and domain for each external script
- Remove the tag the same day you cancel a tool
- Review the inventory every quarter, including WHOIS expiry dates
- Limit who can add custom code or edit the tag manager
- Keep a CSP in place and review its reports
- Prefer self-hosting or pinned versions for anything on checkout and form pages
Year 1
You add a small widget script from a vendor's domain.
Year 3
The vendor closes and the domain expires. The tag stays on your site.
Year 3, later
Someone registers the domain and serves new code.
After audit
You find the dead domain, remove the tag and add a CSP.
How FunnelGuard handles this
FunnelGuard does not check for this yet. Spotting an abandoned script domain that has been re-registered is a possible future check, not a current feature.
What FunnelGuard does today is run your real customer journeys (lead forms, checkouts, booking and chat buttons) on a schedule from the EU or the US. It checks each step, the tracking hits sent to ad and analytics platforms, and whether test leads reach your inbox and CRM. If a hijacked script breaks a form step or stops a tracking hit, that failure can show up as a broken journey, but it is not a check for the script itself.
To watch for this yourself, keep a script inventory, run a quarterly review of external domains with WHOIS or RDAP lookups, use a Content Security Policy in report-only mode to see unexpected sources, and use a free website security scanner or your browser DevTools to list third-party requests.
Questions people ask
What happens if a script domain I use expires?
Anyone can register it and serve their own JavaScript from the old URL. Your pages would then run that code for every visitor that loads the script, with the same access as your own code.
How do I find out which third-party scripts my website loads?
Open your page in Chrome, press F12, go to the Network tab, filter by JS and reload. Note every domain that is not yours. Also search your theme files and tag manager containers for src= and external URLs.
How can I tell if a script domain has been taken over?
Look up the domain with a WHOIS or RDAP tool and check the creation date and registrar. A new registration for a long-standing tool is a warning sign. Also open the script URL and check whether it returns unexpected or scrambled code.
Does Subresource Integrity stop a hijacked script?
Yes, for fixed files. The browser compares the file to the hash you set and refuses to run it if it differs. It does not suit scripts that change often, as the hash would break.
How do I stop old scripts from running on my site?
Remove the script tag from your theme, plugins or tag manager, then clear caches. Add a Content Security Policy that lists only the domains you trust, so forgotten sources are blocked.
Can FunnelGuard detect an abandoned script domain being re-registered?
No, FunnelGuard does not check for this yet. It does run your real journeys and check steps, tracking hits and lead delivery, which can reveal a broken form or tracking, but not the script domain change itself.
Why is my site flagged as unsafe by the browser?
One cause is a third-party script serving malware or redirects. Check the external scripts on the flagged pages, remove any you do not recognise and review the Security issues report in Google Search Console.
Related issues
- OPS-195Magecart / card skimmer script on checkoutFix guide
- OPS-196Unknown third-party domain appears on checkout pageFix guide
- OPS-197Compromised npm/CDN library serving malicious codeFix guide
- OPS-199Tag manager container edited by unknown userFix guide
- OPS-200Too many third-party scripts (performance and risk)Fix guide
- OPS-207Expired third-party SaaS subscription removing widget (reviews, popups)Fix guide