SparkLoop
Search…
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:
1
SL.trackSubscriber({emailAddress});
Copied!
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:
1
<form id="form" action="/" method="POST">
2
<input type="email" name="email" id="email_address">
3
<button>Sign up</button>
4
</form>
5
6
<script>
7
var form = document.getElementById('form');
8
var email =document.getElementById('email_address');
9
10
form.addEventListener('submit', function(e) {
11
// Make sure the SparkLoop library is loaded
12
if (SL) {
13
SL.trackSubscriber(email.value);
14
}
15
})
16
</script>
Copied!
Last modified 1yr ago
Copy link