· 5 years ago · Feb 05, 2021, 05:18 PM
1// Add your code here...
2// Accessing the ONE JS API: window["ONE-KB7YLIQSRT-8592"]
3// The interaction path is: "https://www.thunderhead.com/"
4// Key property is: your email address
5
6 //send interaction when the view for this page.
7 window["ONE-KB7YLIQSRT-8592"].sendInteraction("https://www.thunderhead.com/", {
8 key: "markcraigwork@gmail.com",
9 customerKey: "some_id",
10 more: "attributtes!"
11 })
12
13//Gets email adress to var
14function email() {
15 var input = document.getElementById("email-address").value;
16 alert(input);
17}
18//registers the click on the submit button and gets the input of the email address
19document.getElementById("submit").addEventListener("click", email);
20
21//sends the response
22await window["ONE-KB7YLIQSRT-8592"].sendInteraction("https://www.thunderhead.com/", {
23 key: "markcraigwork@gmail.com",
24 customerKey: "some_id",
25 more: "attributtes!"
26})
27.then((email) => {window["ONE-KB7YLIQSRT-8592"].processResponse(email);
28});
29//validates the email
30function validateEmail(iput) {
31 const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
32 return re.test(String(input).toLowerCase());
33}
34
35document.addEventListener("ONE-KB7YLIQSRT-8592",function(){
36 console.log("Tag API is ready!");
37});