Custom event from URL parameter

Send2CRM custom events are a good way to pass information from the website to the CRM when no form submission is involved. Below is a basic example of how to generate an event based on the presence of a URL parameter.

// Do not act until the document is loaded. window.addEventListener('load', (evt) => { // Get the custom parameter from the URL. let urlParams = new URLSearchParams(window.location.search); if (urlParams.has('myparam')) { // Record a custom session event. send2crm.analytics?.setCustomEvent('MYEVENT', { myparam: urlParams.get('myparam') }); } });