1
Set up the HTML form
Create a form with the method attribute set to POST and a submit button.
2
Listen for the submit event
Use
addEventListener to handle the form’s submit event.3
Collect and check the form data
Build a data object from the form fields with
FormData, then add your agentId and, if you track campaigns, a utmSource.- Valid email
- Valid domain
The email must be a valid address, with an
@ and a domain.4
Send the POST request
Send the data as JSON with
fetch. A complete example:file.html