Opening the SavvyCal embed popup manually

The SavvyCal embed script comes with support for opening the SavvyCal embed popup when a hyperlink is clicked, by adding the data-savvycal-embed attribute to the hyperlink (see instructions). However, some website builder environments are restrictive and don't allow adding this data attribute to anchor tags.

This method requires basic knowledge about JavaScript. You might need to consult with a web developer to implement this code.

If your website builder allows you to add scripts to the page, you work around this limitation with a custom script to simulate the hyperlink trigger (without adding the data attribute).

<script>
document.addEventListener('DOMContentLoaded', function() {
  const anchorElements = document.getElementsByTagName('a');

  for (let i = 0; i < anchorElements.length; i++) {
    const anchor = anchorElements[i];

    if (anchor.textContent.includes('Schedule')) {
      anchor.addEventListener('click', function(event) {
        event.preventDefault();
        
        // Replace the value for "link" below with your link identifier
        // e.g. "johndoe/chat" if your link is savvycal.com/johndoe/chat
        SavvyCal('open', { link: "REPLACE_WITH_YOUR_LINK_IDENTIFIER" });      
      });    
    }  
  }
});
</script>

This script looks for all <a> elements that contain the word "Schedule" and triggers the SavvyCal widget to open the link you specify when the visitor clicks that link.

Still need help? Contact Us Contact Us