BlogGuides · September 30, 2026 · 5 min read

Contact Form 7 Thank-You Page: Redirect After a Successful Submission

Create a useful CF7 thank-you page, scope the redirect to the right successful form, test failure paths and avoid counting page reloads as leads.

Conceptual illustration of a completed contact form leading through a doorway to a thank-you page.
Conceptual illustration generated for this article; not a product screenshot or measured result.

A Contact Form 7 thank-you page can give visitors a clear next step after they submit an inquiry. It might explain when to expect a reply, offer relevant preparation material or link to a separate booking process. A redirect is optional: you do not need one simply to measure a successful form submission.

The safest design begins with the visitor’s next task and keeps the submission event separate from the destination page view. This guide provides a scoped JavaScript example and a test matrix. It does not require changing your mail delivery settings or treating a page visit as proof that an inquiry reached an inbox.

Decide whether a separate page helps

An inline success message is usually sufficient for a short inquiry. A separate page becomes useful when the next step needs more explanation than a sentence can provide. For example, a consultancy could show what information will help its team prepare for a call, while a support team could explain where to find the reference material mentioned in its acknowledgment.

Keep the promise narrow. A form submission is not an appointment confirmation, an approved application or a completed purchase. Write destination copy that accurately describes the step already completed and any action the visitor still needs to take.

The official Contact Form 7 redirect guidance uses a DOM event and explains that analytics tracking does not depend on a thank-you page. If reporting is your only reason for redirecting, start with our GA4 and Google Tag Manager guide instead.

Create a stable destination before adding code

Create a normal page with a short heading, an explanation of what happens next and a way back to relevant site content. Verify that its HTTPS URL loads without an unexpected login requirement or redirect chain. Use a stable path that your team will not casually rename during a design update.

A general acknowledgment page should not reveal a visitor’s submitted message or email address. Do not append form fields to the destination URL: URLs can be copied, logged and exposed to analytics tools. A public page also should not display a fabricated inquiry identifier or imply that a personalized record was securely retrieved.

If the page is not useful as a search result, consider your site’s existing indexing controls separately. Hiding a page from search does not restrict access. Private documents or individualized account details need an appropriate access mechanism, not an obscure thank-you URL.

Redirect only the intended successful form

Contact Form 7 exposes separate events for invalid input, suspected spam, mail failure and successful sending. Use wpcf7mailsent for this example, and match detail.contactFormId so another form on the same site does not take the same path. The official DOM event reference documents both the event and identifier.

The following is an illustrative script for a site-specific JavaScript file. Replace 123 with the form ID observed on your own site and change the destination path. Load it once through your normal theme or site-plugin asset workflow, preferably on pages that contain this form. Do not paste it into Contact Form 7’s Form or Mail template.

(() => {
  const expectedFormId = '123';
  let redirectScheduled = false;

  document.addEventListener('wpcf7mailsent', (event) => {
    if (String(event.detail.contactFormId) !== expectedFormId) return;
    if (redirectScheduled) return;
    redirectScheduled = true;

    window.setTimeout(() => {
      window.location.assign('/thank-you/');
    }, 3000);
  });
})();

The short delay gives the existing success message some time to appear. It is not proof that every analytics request has finished, and it is not an accessibility guarantee. Keep a clear success message and consider providing a normal next-step link there so the visitor can continue if automatic navigation is unavailable. Test the actual experience with your site’s accessibility requirements.

This handler applies to AJAX submissions that emit the documented event. It is not a universal fallback for every non-JavaScript or custom submission mode. Avoid the old on_sent_ok approach mentioned in legacy tutorials; use the current documented event mechanism.

Choose one primary conversion definition

A thank-you page can be opened directly, bookmarked, refreshed or revisited with the browser’s history. Those visits are not necessarily new inquiries. If you count both the successful form event and every destination page view as leads, one real submission can become multiple reported conversions.

Write down which event is your primary inquiry measure and use destination views as a separate diagnostic measure if they are helpful. A discrepancy may reveal direct visits, blocked analytics, a broken redirect or different consent conditions. It does not by itself establish which number is correct.

A successful CF7 sending event also does not prove inbox delivery or downstream CRM completion. Keep the conversion-rate definition aligned with the stage you actually measure. CF7 Analytics should not be described as guaranteeing that this redirect, a third-party analytics event and a recipient inbox all agree.

Use a test matrix that includes failure paths

Test with synthetic data on staging before making the script active on production. Record the expected outcome for each case, then observe the browser destination and the underlying form result independently:

  • A valid submission of the target form should display its success state and reach the intended page.
  • Invalid input should leave the visitor on the form with useful feedback.
  • A controlled spam or mail-failure result should not trigger this success redirect.
  • A different form on the same page should keep its own behavior.
  • Reloading or opening the thank-you URL directly should not create a new form submission.
  • Keyboard navigation, mobile display and the browser’s Back button should remain understandable.

Repeat the successful case after the site’s normal caching and script-optimization settings are active. A test performed only while logged in can miss differences in the public page. Check for an older redirect plugin or second script that competes with your new handler; use one owner for this behavior.

Keep a small maintenance record

Record the form ID, destination URL, script location, primary conversion definition and last successful test date. Include the redirect in your Contact Form 7 acceptance checklist after theme changes or major form edits.

If the next-step page is removed later, remove or update the redirect in the same release. A working submission that immediately sends someone to a missing page can make the entire experience feel broken. The best thank-you page leaves visitors confident about the next action without overstating what the system has completed.