-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
294 lines (265 loc) · 12.2 KB
/
index.html
File metadata and controls
294 lines (265 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Skybeam Pixel Test Harness (Full)</title>
<style>
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; margin: 2rem; line-height: 1.45; }
.card { border: 1px solid #e5e7eb; border-radius: 14px; padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
label { display:block; margin:.5rem 0 .25rem; }
input, select, textarea, button, a.btn { padding:.55rem .7rem; border-radius:10px; border:1px solid #d1d5db; width:100%; max-width:520px; }
button, .btn { cursor:pointer; display:inline-block; width:auto; background:#fff; }
.row { display:flex; gap:0.75rem; flex-wrap:wrap; align-items:center; }
.muted { color:#6b7280; font-size:.92rem; }
code { background:#f6f8fa; padding:.1rem .25rem; border-radius:6px; }
.pill { display:inline-block; padding:.2rem .5rem; border:1px solid #d1d5db; border-radius:999px; font-size:.8rem; }
.ok { border-color:#2e7d32; color:#2e7d32; }
.grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
</style>
<!-- Base Skybeam Pixel -->
<script>
(function(e,n,t){e["$$sbFn"]=t;e[t]=e[t]||function(){(e[t].q=e[t].q||[]).push(arguments)};var c=n.getElementsByTagName("script")[0],o=n.createElement("script");o.async=true;o.src="https://www.skybeam-analytics.com/js/v1/beacon.js";c.parentNode.insertBefore(o,c)})(window,document,"sb_beacon");
// Beacon ID вже встановлено
sb_beacon('setup', 'beacon', '7fb0dbb6-7d0a-4bff-878d-7ae1fc515c3b');
sb_beacon('setup', 'user_tracking', true);
sb_beacon('send', 'pageview');
</script>
<!-- Contact Form & CTA Tracking (from setup guide) -->
<script>
(function() {
'use strict';
if (typeof window.sb_beacon === 'undefined') {
window.sb_beacon = function(action, type, event, data) {
console.log('sb_beacon called (mock):', { action, type, event, data });
};
}
function getInterestedInValue() {
let interestedIn = '';
const selectors = [
'select[name*="interested"]','select[name*="service"]','select[name*="care"]',
'input[name*="interested"]:checked','input[name*="service"]:checked','input[name*="care"]:checked',
'[data-field*="interested"]','[data-field*="service"]'
];
for (let selector of selectors) {
const element = document.querySelector(selector);
if (element && element.value) { interestedIn = element.value; break; }
}
return interestedIn || 'not_specified';
}
function trackFormSubmission(formElement, triggerType = 'submit_button') {
const interestedIn = getInterestedInValue();
sb_beacon("send", "event", "lead", {
type: "form_submit",
form_name: "Contact Us",
page_url: location.href,
interested_in: interestedIn,
ts: Date.now(),
trigger_type: triggerType
});
console.log('Form submission tracked:', { form: formElement, interested_in: interestedIn, trigger_type: triggerType });
}
function trackGetStartedClick(element) {
const interestedIn = getInterestedInValue();
sb_beacon("send", "event", "lead", {
type: "form_submit",
form_name: "Contact Us",
page_url: location.href,
interested_in: interestedIn,
ts: Date.now(),
trigger_type: 'get_started_button'
});
console.log('Get Started button clicked:', { element, interested_in: interestedIn });
}
function initializeTracking() {
const allButtons = document.querySelectorAll('button, a, input[type="button"], input[type="submit"], .btn, .button');
allButtons.forEach(button => {
const text = (button.textContent || button.value || '').toLowerCase();
if (text.includes('get started')) {
button.addEventListener('click', function() { trackGetStartedClick(button); });
}
});
const forms = document.querySelectorAll('form');
forms.forEach(form => {
form.addEventListener('submit', function(e) { trackFormSubmission(form, 'form_submit'); });
const submitButtons = form.querySelectorAll('input[type="submit"], button[type="submit"], button:not([type])');
submitButtons.forEach(button => {
const text = (button.textContent || button.value || '').toLowerCase();
if (text.includes('submit')) {
button.addEventListener('click', function() {
setTimeout(() => { trackFormSubmission(form, 'submit_button'); }, 100);
});
}
});
});
}
function safeOnReady(fn) {
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', fn, { once: true });
else fn();
}
safeOnReady(initializeTracking);
setTimeout(function(){ safeOnReady(initializeTracking); }, 2000);
const observer = new MutationObserver(function(mutations) {
for (const m of mutations) {
if (m.addedNodes && m.addedNodes.length > 0) {
setTimeout(function(){ safeOnReady(initializeTracking); }, 500);
}
}
});
function startObserver() {
const target = document.body || document.documentElement;
if (!target || !(target instanceof Node)) { setTimeout(startObserver, 50); return; }
try { observer.observe(target, { childList: true, subtree: true }); }
catch (e) { setTimeout(startObserver, 50); }
}
safeOnReady(startObserver);
})();
</script>
<!-- Live Chat postMessage tracking (HubSpot origins only) -->
<script>
(function () {
const HUBSPOT_ORIGIN_SUFFIXES = ['.hubspot.com', '.hsappstatic.net', '.usemessages.com'];
function isAllowedHubSpotOrigin(origin) {
try { return HUBSPOT_ORIGIN_SUFFIXES.some(sfx => new URL(origin).hostname.endsWith(sfx)); }
catch { return false; }
}
function parseMessage(raw) {
if (!raw) return null;
if (typeof raw === 'string') { try { return JSON.parse(raw); } catch { return null; } }
return raw;
}
function sendChatOpenedEvent() {
try {
sb_beacon('send', 'event', 'other', { page_url: location.href, timestamp_ms: Date.now(), source: 'postMessage' });
} catch {}
}
function onMessage(event) {
if (!isAllowedHubSpotOrigin(event.origin)) return;
const msg = parseMessage(event.data);
if (msg && msg.type === 'open-change' && msg.data && msg.data.isOpen === true) {
sendChatOpenedEvent();
}
}
window.addEventListener('message', onMessage);
})();
</script>
<!-- Extended Events Demo helpers -->
<script>
function showToast(msg){
let t = document.getElementById('toast');
if(!t){
t = document.createElement('div');
t.id = 'toast';
t.style.position='fixed'; t.style.bottom='16px'; t.style.right='16px';
t.style.padding='10px 14px'; t.style.border='1px solid #d1d5db';
t.style.borderRadius='10px'; t.style.background='#fff'; t.style.boxShadow='0 4px 16px rgba(0,0,0,.12)';
t.style.fontFamily='system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif';
document.body.appendChild(t);
}
t.textContent = msg;
t.style.opacity='1';
setTimeout(()=>{ t.style.transition='opacity .6s'; t.style.opacity='0'; }, 2500);
}
function fireLead() {
const cat = (document.getElementById('lead_category')?.value || '').trim();
const payload = {};
if (cat) payload.lead_category = cat;
sb_beacon('send', 'event', 'lead', payload);
console.log('Lead sent', payload);
}
function fireSignUp() {
const method = (document.getElementById('sign_up_method')?.value || '').trim();
const payload = {};
if (method) payload.sign_up_method = method;
// Надсилаємо три варіанти імені події на сумісність
// sb_beacon('send', 'event', 'sign', payload);
sb_beacon('send', 'event', 'sign_up', payload);
// sb_beacon('send', 'event', 'signup', payload);
console.log('SignUp compat fired: sign, sign_up, signup', payload);
showToast('Sent Sign Up variants: sign / sign_up / signup');
}
function fireAddToCart() {
const id = document.getElementById('item_id')?.value || '';
const name = document.getElementById('item_name')?.value || '';
const price = document.getElementById('item_price')?.value;
const qty = document.getElementById('item_qty')?.value;
const cat = document.getElementById('item_cat')?.value || '';
const payload = {};
if (id) payload.item_id = id;
if (name) payload.item_name = name;
if (price) payload.item_price_usd = parseFloat(price);
if (qty) payload.quantity = parseInt(qty, 10);
if (cat) payload.item_category = cat;
sb_beacon('send', 'event', 'add_to_cart', payload);
console.log('AddToCart sent', payload);
}
function firePurchase() {
const total = document.getElementById('total_price')?.value;
const payload = {};
if (total) payload.total_price_usd = parseFloat(total);
sb_beacon('send', 'event', 'purchase', payload);
console.log('Purchase sent', payload);
}
</script>
</head>
<body>
<div class="card">
<h1>Skybeam Pixel Test Harness (Full)</h1>
<p class="muted">Відкрий DevTools → <span class="pill ok">Network</span> (фільтр: <code>skybeam-analytics.com</code>) та <span class="pill ok">Console</span>.</p>
</div>
<div class="grid">
<div class="card">
<h2>Contact Us</h2>
<form id="contact-form">
<label for="name">Full name</label>
<input id="name" name="name" placeholder="Ada Lovelace" required />
<label for="email">Email</label>
<input id="email" name="email" type="email" placeholder="ada@example.com" required />
<label for="interested">Interested in</label>
<select id="interested" name="interested_service">
<option value="Companion Care">Companion Care</option>
<option value="Skilled Nursing">Skilled Nursing</option>
<option value="Physical Therapy">Physical Therapy</option>
<option value="not_specified">Other / Not sure</option>
</select>
<label for="notes">Notes</label>
<textarea id="notes" name="notes" rows="4" placeholder="Tell us more..."></textarea>
<div class="row" style="margin-top: .75rem">
<button type="submit">Submit</button>
<a href="#" class="btn get-started">Get Started</a>
</div>
</form>
</div>
<div class="card">
<h2>Lead (optional category)</h2>
<label>Lead Category</label>
<input id="lead_category" placeholder="INSERT_CATEGORY" />
<div class="row"><button onclick="fireLead()">Send Lead</button></div>
</div>
<div class="card">
<h2>Sign Up (method)</h2>
<label>Sign Up Method</label>
<input id="sign_up_method" placeholder="email / google / apple" />
<div class="row"><button onclick="fireSignUp()">Send Sign Up (compat)</button></div>
</div>
<div class="card">
<h2>Add to Cart</h2>
<label>Item ID</label><input id="item_id" placeholder="INSERT_ITEM_SKU" />
<label>Item Name</label><input id="item_name" placeholder="INSERT_ITEM_NAME" />
<label>Item Price USD</label><input id="item_price" type="number" step="0.01" placeholder="INSERT_ITEM_PRICE" />
<label>Quantity</label><input id="item_qty" type="number" step="1" min="1" placeholder="1" />
<label>Item Category</label><input id="item_cat" placeholder="INSERT_ITEM_CATEGORY" />
<div class="row"><button onclick="fireAddToCart()">Send Add To Cart</button></div>
</div>
<div class="card">
<h2>Purchase</h2>
<label>Total Price USD</label><input id="total_price" type="number" step="0.01" placeholder="INSERT_TOTAL_PRICE" />
<div class="row"><button onclick="firePurchase()">Send Purchase</button></div>
</div>
</div>
<div class="card">
<h2>Manual Console Helpers</h2>
<p class="muted">Приклад: <code>sb_beacon('send','event','lead',{type:'manual_test',ts:Date.now()})</code></p>
</div>
</body>
</html>