PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.7.0
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.7.0
1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / frontend / tracking / abandoned-carts.js
hostinger-reach / frontend / tracking Last commit date
abandoned-carts.js 9 months ago
abandoned-carts.js
56 lines
1 const EMAIL_FIELD_SELECTORS = [
2 'form.checkout input[name="billing_email"]',
3 'form.woocommerce-checkout input[name="billing_email"]',
4 'form[name="checkout"] input[type="email"]',
5 'form.checkout input[type="email"]',
6 'form[id*="checkout"] input[type="email"]',
7 'form[class*="checkout"] input[type="email"]',
8 'input#billing_email',
9 'input[type="email"]'
10 ];
11
12 (function () {
13
14 const findEmailInput = () => {
15 for (const field of EMAIL_FIELD_SELECTORS) {
16 let emailField = document.querySelector(field);
17 if (emailField) return emailField;
18 }
19
20 return null;
21 }
22
23 const handleAction = () => {
24
25 const data = new FormData();
26 data.append('action', hostinger_reach_email_capture_data.action);
27 data.append('nonce', hostinger_reach_email_capture_data.nonce);
28
29 let email = findEmailInput();
30 if (!email) {
31 return;
32 }
33
34 data.append('email', email.value);
35
36 fetch(hostinger_reach_email_capture_data.ajaxurl, {
37 method: 'POST',
38 body: data
39 });
40 }
41
42 const init = () => {
43
44 const emailInput = findEmailInput();
45
46 if (!hostinger_reach_email_capture_data || !emailInput) {
47 return;
48 }
49
50 emailInput.addEventListener('change', handleAction, {passive: true});
51 emailInput.addEventListener('blur', handleAction, {passive: true});
52 }
53
54 document.addEventListener('DOMContentLoaded', init);
55 })();
56