How to embadded Calendly in Wordpress Website with get query paramenters in It

1)   Add this is Elementor HTML Code ... 



 <!-- Add this div where you want to embed the Calendly event -->

<div id="calendly-embed-container" style="height: 600px;"></div>


<script>

  function GetURLParameter(sParam) {

    let sPageURL = window.location.search.substring(1);

    let sURLVariables = sPageURL.split('&');

    for (let i = 0; i < sURLVariables.length; i++) {

      let sParameterName = sURLVariables[i].split('=');

      if (sParameterName[0] == sParam) {

        if (!sParameterName[1]) {

          return "";

        }

        return decodeURIComponent(sParameterName[1]);

      }

    }

    return "";

  }


  let utm_source = GetURLParameter('leadSource');

  let utm_medium = GetURLParameter('leadOwner');

  let utm_content = GetURLParameter('mailId');


  let urlToSend = 'https://calendly.com/gehlotravindra1/30min';  // Updated Calendly URL

  if (utm_content) {

    urlToSend += `?guests=${utm_content}`;  // Adjusted for query parameters

  }


  // Create an iframe element

  let iframe = document.createElement('iframe');

  iframe.setAttribute('src', urlToSend);

  iframe.setAttribute('style', 'width: 100%; height: 100%; border: 0;');


  // Append the iframe to the specified div

  document.getElementById('calendly-embed-container').appendChild(iframe);

</script>


No comments:

Post a Comment

Pages