How to redirect to a confirmation page when using an embedded Calendly calendar

Why

  • You are using an embedded Calendly calendar and you want redirect the user to a different page after a meeting has been scheduled. The redirection option supported by Calendly is not a great experience because it warns the user about the redirection. However, if you are using an embedded calendar, you can add a short script to redirect to a different page without the warning.

Redirection code

Insert this code immediately under the Calendly embed code in your web page. You must change the destination URL highlighted below to the page of your choice.

<!-- Insert after your Calendly embed code -->
<script type="text/javascript">
  window.addEventListener('message', function(e) {
    if (e.data.event && e.data.event === 'calendly.event_scheduled') {
      window.location.href = 'https://example.com/your/page';
    }
</script>

Technical details (optional)

This JavaScript snippet listens for a specific message from the Calendly embed indicating that a meeting has been successfully scheduled. Once that event is detected, it automatically redirects the user to a confirmation page.

  • window.addEventListener('message', function(e) {...})
    This sets up a listener for messages sent to the browser window. Calendly sends messages when certain actions occur within the embedded calendar.
  • e.data.event === 'calendly.event_scheduled'
    This checks if the message received is specifically the one that indicates a meeting has been scheduled.
  • window.location.href = 'https://example.com/your/page';
    If the event matches, the browser is redirected to the specified URL.

This works with Calendly’s inline embed, popup widget, or popup text link.

Step-by-step instructions

  1. If you configured redirection on your Calendly calendar, remove it.

    Sign into your Calendly account, click your calendar, and go to More Options. Scroll down to Confirmation Page and ensure that After booking is set to Display confirmation page. It should not be set to Redirect to external site.

  2. Sign into your website editor and open the web page containing your embedded Calendly calendar.

    For example, if you are using WordPress, then sign into WordPress and navigate to the page or post containing Calendly.

  3. Locate the Calendly widget

    In WordPress, Calendly is typically embedded with an HTML block. On other platforms, search for “calendly” if you cannot find it. A typical Calendly embed code contains a <div> and a <script> tag.

  4. Add the redirection script immediately under the snippet

    Paste the redirection script immediately under the Calendly embed code. Be sure to update the target page with the correct URL of your confirmation page.

  5. Save and test.

    Always test to make sure the page is redirecting correctly.

References

Leave a Reply