Skip to main content
Manually track subscribers

Use this code to track sign ups manually

Manuel Frigerio avatar
Written by Manuel Frigerio
Updated over a week ago

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 the emailAddress argument 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>

Did this answer your question?