Webflow sync, pageviews & more.
NEW

How can I add an onClick event to a Webflow button in order to trigger a Calendly embed popup, following the instructions provided by Calendly? I've tried the method mentioned in a thread but it's not working. Please assist.

TL;DR
  • Add Calendly’s embed script in Webflow’s Footer code section and publish the site.
  • Assign a unique ID to your button, then add a script before the tag using Calendly.initPopupWidget() to trigger the popup on button click.

To trigger a Calendly popup via an onClick event on a Webflow button, follow Calendly's updated embed instructions and ensure it's correctly integrated in Webflow.

1. Add the Calendly Embed Script to Your Webflow Project

  • Go to Project Settings in Webflow.
  • Navigate to the Custom Code tab.
  • In the Footer Code section, paste the Calendly embed script:
  • https://assets.calendly.com/assets/external/widget.js
  • Example:
  • <script src="https://assets.calendly.com/assets/external/widget.js" type="text/javascript"></script>
  • Click Save Changes, then Publish the site.

2. Assign a Unique ID or Class to the Button

  • Select your button in the Webflow Designer.
  • Go to the Settings panel (gear icon).
  • Add a unique ID (e.g., calendly-popup-btn), or use a class like calendly-btn.

3. Add the JavaScript Trigger for the Popup

  • In the Webflow Designer, go to the Page Settings of the page where the button is located.
  • Scroll to the Before tag field and add the custom script, replacing the event ID with yours:
  • Example:
    ```html ```
  • Replace 'https://calendly.com/your-username/your-event' with your actual Calendly URL.
  • Click Save, then Publish the site.

4. Common Troubleshooting Tips

  • Ensure the Calendly script loads before calling Calendly.initPopupWidget. Placing the script in the Footer ensures this.
  • Confirm that the button ID matches what you're using in the script.
  • Test in a live published environment, not in Webflow Preview mode.
  • Calendly popups won't work properly if browser settings block pop-ups or third-party scripts.

Summary

To trigger a Calendly popup on button click in Webflow: add Calendly's script in the Footer code, assign a unique ID to your button, and use Calendly.initPopupWidget() in a script placed before the </body> tag. Ensure scripts are correctly loaded and test only on the live site.

Rate this answer

Other Webflow Questions