Passing data from login form to webhook
-
I have a URL param on the login page that I want to pass to a login success webhook handler.
How can I do so?
-
There is no official way to do this but you can overload one of the custom fields as outlined here.
Here's sample code to do this, assuming that the parameter you want to track is
registrationCode
.<script> const queryString = window.location.search; let urlParams = new URLSearchParams(queryString); const registrationCode = urlParams.get('registrationCode'); if (registrationCode) { console.log('New query string found of '+ registrationCode); let input = document.querySelector('.customParam'); input.setAttribute('value', 'registrationCode = ' + registrationCode); console.log(input.type, input.name, input.value); } </script>
Then, in the login form, you want to make sure you have this input field:
<input class="customParam" type="hidden" name="metaData.device.description"/>
The value of
metaData.device.description
in the webhook event will be the value of theregistrationCode
parameter. -