Track UTMs in Calendly on Wix
On your book a call page...
Add the following script
import wixWindowFrontend from 'wix-window-frontend';
$w.onReady(function () {
$w("#handlCalendly").customClassList.add("calendly-inline-widget")
wixWindowFrontend.postMessage('HandLCalendly');
});
After that in your Custom Code section in Wix, add the following. Don't forget to swap the <license_key>
with your own license key.
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<script>
window.onmessage = function(event) {
if (event.data == 'HandLCalendly'){
setTimeout(function(){if (handlj('.wixui-calendly-inline-widget').length > 0) { handlj('.wixui-calendly-inline-widget').next()[0].style="min-width:320px;height:580px;position:relative";Calendly.initInlineWidget({url:"https://calendly.com/franchise-b-protek/15-20-minutes-call-clone",parentElement:handlj('.wixui-calendly-inline-widget').next()[0],utm:{utmCampaign:"object"==typeof HandL&&HandL.getAll().utm_campaign||"",utmSource:"object"==typeof HandL&&HandL.getAll().utm_source||"",utmMedium:"object"==typeof HandL&&HandL.getAll().utm_medium||"",utmContent:"object"==typeof HandL&&HandL.getAll().utm_content||"",utmTerm:"object"==typeof HandL&&HandL.getAll().utm_term||""}});}},500);
}
};
handl_custom_params=[];var handl_js=document.createElement("script");handl_js.setAttribute("src","https://track.utmsimple.com/utm.js?license=<license_key>"),document.head.appendChild(handl_js),handl_js.onload=function(){};
</script>
That's it