Triggering Zapier/External API on Button Click
Simply add the following snippet to your webpage and bind it to a button click event.
The following script will capture data from HandL UTM grabber and trigger your webhook with all the gathered data when the button is clicked.
This is especially useful for sending data seamlessly when users engage by clicking a specific button on your page.
Don't forget to change the URL below with your own Webhook URL.
<script>
document.getElementById("your-button-id").addEventListener("click", function() {
var data = HandL.getAll(); //this will have all the tracking data
data.customParam1 = 'value1'; //add your own
data.customParam2 = 'value2';
var json = JSON.stringify(data);
var xhr = new XMLHttpRequest();
xhr.open("POST", 'https://your-url.com/endpoint', true);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xhr.send(json);
});
</script>