Manual tracking subscribers

If your website uses a custom form that doesn't send the submit event (for example, single-page apps that use React) you can still use SparkLoop by tracking sign ups manually.

To track sign ups manually, simply call this code:

SL.trackSubscriber({emailAddress});

Make sure to replace {emailAddress} with the actual email address of the person who signs up.

Below a very simple example that shows how to use the manual tracking:

<form id="form" action="/" method="POST">
<input type="email" name="email" id="email_address">
<button>Sign up</button>
</form>
‚Äč
<script>
var form = document.getElementById('form');
var email =document.getElementById('email_address');
form.addEventListener('submit', function(e) {
// Make sure the SparkLoop library is loaded
if (SL) {
SL.trackSubscriber(email.value);
}
})
</script>