Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

125
Views
Appending parameters to onClick URL

We're trying to append UTM parameters to a calendly link. It was working great when it was a standard anchor link, but now the site dev has changed the button to an onClick event.

Here is the code we were using to append the parameters to the URL:

(function() {
var links = document.querySelectorAll('a');
    for (var i = 0; i < links.length; i++) {
      if (links[i].hostname == "calendly.com") {
        var calendlyLink = links[i];
        if({{Javascript - finalParams}} !== '?' || {{Javascript - finalParams}} !== 'undefined'){
        calendlyLink.href = calendlyLink.href + {{Javascript - finalParams}};
      console.log(calendlyLink);
            }
      }
    };
 
 })();

Here is the new button code:

<a class="demo-button" onclick="Calendly.initPopupWidget({url: 'https://calendly.com/xxxxxx/product-demo'});return false;">Button Text</a>

What do I need to change to fix this so the UTM parameters are added to the URL?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The Calendly.initPopupWidget method accepts a utm parameter option that can be used to prefill the utm parameters in the iframe (see here)

<a class="demo-button" onclick="Calendly.initPopupWidget({url: 'https://calendly.com/xxxxxx/product-demo', utm: { utmSource: 'utmSource', utmCampaign: 'utmCampaign' } });return false;">Button Text</a>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!