Skip to content
FunnelGuard

Fix guide by FunnelsGuard

CTA button does nothing when clicked: fix JavaScript errors

CNV-096High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Many buttons rely on JavaScript: to open a popup, submit a form, add an item to the cart, start a booking widget or open a chat. If that script hits an error, the browser stops running it. The button still looks normal, but clicking it does nothing: no popup, no page change, no message.

Common causes are a script that fails to load, a typo or a missing element (Cannot read properties of null), two scripts that conflict (for example two copies of jQuery), a plugin update, a tag manager change, or code that assumes something exists that does not on this page.

Why it costs you leads or sales

The visitor wanted to act and you gave them nothing. There is no error message, so most people click once or twice and leave. Because the page loads fine, you will not see a drop in traffic. You only see fewer leads or orders, and it is easy to blame the ads.

Same traffic, working vs broken buttonExample numbers
Same traffic, working vs broken button (example)CTA works: 40 leads per week; CTA script errors: 0 leads per week01531400CTA worksCTA script errorsleads per week

Example: 1,000 visitors a week, with the CTA working and then broken by a script error. Numbers are illustrative.

Where the funnel breaks
  1. Ad or search clickVisitor lands on the page
  2. Click the CTAScript throws an error
  3. Form or checkoutNever opens
  4. Lead or saleNever happens

The click never reaches the next step, so everything after it is lost.

A click that goes nowhere

The button looks fine, but the script behind it fails.

How to check if your site has it

Find the error in your browser
  1. Open the page in a private window

    This avoids extensions and cached files affecting the result. Use the same URL your ads or links send people to.

  2. Open the developer console

    In Chrome, Edge or Firefox press F12 (or Cmd+Option+J on Mac Chrome), then choose the Console tab.

  3. Reload and click the CTA

    Watch for red lines such as Uncaught TypeError, ReferenceError or Failed to load resource.

  4. Read the file and line

    The error links to a script file and line number. That tells you whether the cause is your theme, a plugin, a tag manager tag or a third-party widget.

  5. Test on mobile

    Use device mode in the developer tools, then a real phone. Some errors only happen on certain browsers or screen sizes.

How to fix it

The fix depends on what the error points to. Start with the most recent change: a plugin update, a new tag, a theme edit or a new popup tool.

Fix by platform
  1. Find the source file

    If the error path contains /wp-content/plugins/NAME/, that plugin is the cause. If it contains /themes/, it is your theme.

  2. Test for a conflict

    Deactivate the plugin (or switch plugins off one at a time, ideally on a staging copy) and retest the click. Update it, replace it or contact its support.

  3. Check optimisation plugins

    In your caching or performance plugin, turn off JavaScript minify, combine and delay for the affected script, then clear the cache and retest.

Safer click handlerjavascript
document.addEventListener('DOMContentLoaded', function () {
  var btn = document.querySelector('#cta-button');
  if (!btn) return; // element missing on this page, do nothing
  btn.addEventListener('click', function (e) {
    try {
      // your popup, tracking or form logic here
    } catch (err) {
      console.error('CTA handler failed', err);
      window.location.href = '/contact/'; // fallback so the visitor is not stuck
    }
  });
});
CTA markup

Fragile

  • Button is a div with only a JavaScript click handler
  • Handler runs before the element exists
  • One failed script stops everything

Resilient

  • Button is a real link or submit button
  • Handler waits for the page and checks the element
  • Fallback sends the visitor to a working page

How to confirm it's fixed

Confirmation checks
  • Console shows no new red errors when you load the page and click the CTA
  • The popup, form, cart or next page opens as expected
  • Works in Chrome, Safari and Firefox
  • Works on a real phone, not only device mode
  • Works in a private window with the cache cleared
  • Form submission arrives in your inbox or CRM
  • Conversion event still shows in GA4 or your ad platform

How to prevent it happening again

Most of these errors arrive with a change: a plugin update, a new tag, a theme edit or a new widget. Test the main CTA after each one.

How a silent break unfolds
  1. Day 0

    A plugin auto-updates and its script now errors on the landing page.

  2. Day 1-6

    Visitors click the CTA and nothing happens. Traffic looks normal.

  3. Day 7

    Someone notices leads are down and starts digging.

  4. Day 7

    The error is found in the console and the plugin is rolled back.

Prevention habits
  • Test updates on a staging copy first
  • Click every main CTA after publishing site or tag manager changes
  • Keep a list of scripts and tags on key pages and remove unused ones
  • Avoid loading several versions of the same library
  • Use real links and submit buttons where possible
  • Run an automated click test on your key journeys on a schedule

How FunnelGuard handles this

FunnelGuard detects this today. A robot visitor runs your real customer journey on a schedule, clicks the CTA, and checks whether the expected next step happens. It also records console errors during the run. If the click leads nowhere, the check fails.

A failure is re-checked from a second region before one alert goes out, by email, Slack, Teams, WhatsApp, webhook or PagerDuty, with a screenshot and a likely cause. Test traffic is marked (utm_source=funnelguard, fg_test=1) and never bypasses CAPTCHAs or bot protection. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans have a 3-day free trial.

Questions people ask

Why does my button do nothing when I click it?

Most often a JavaScript error stopped the script that powers the button. Open the browser console (F12), click the button and look for a red error. It will name the file and line, which tells you if the cause is your theme, a plugin or a tag.

How do I find JavaScript errors on my website?

Open the page, press F12 and choose the Console tab. Reload the page and click the button. Red messages such as Uncaught TypeError or ReferenceError show what failed and where.

Why did my CTA button stop working after a plugin update?

The update may have changed a script that conflicts with another one, or removed an element your button relies on. Deactivate the plugin, retest, then roll back, update again or contact support. Test updates on a staging copy first.

Can Google Tag Manager break my buttons?

Yes. A Custom HTML tag with faulty code can throw an error that stops other scripts. Use GTM Preview mode, pause the suspect tag and click the button again to see if it works.

Why does the button work for me but not for visitors?

Your browser may have cached files, different extensions or a different device. Errors can also depend on browser, screen size, consent choices or logged-in state. Test in a private window, on mobile and in other browsers.

How can I make a CTA work even if JavaScript fails?

Use a real link or a form submit button instead of a div with a click handler. Add a fallback URL in your code so visitors still reach a working page if a script fails.

How do I know when a CTA breaks without checking by hand?

Run an automated journey check that clicks the CTA on a schedule and alerts you if the next step does not happen. FunnelGuard does this and also records console errors during the run.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: click step + console errors.

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.