* HKILD Section Engagement Tracking for Wix * * Tracks: * - Time spent in each section (using Intersection Observer) * - Button clicks in each section * * Sends data to Wix Collection: hkild_section_engagement * * Installation: * 1. Add this code to Wix Custom Code element * 2. Place on PD mobile page */ (function() { 'use strict'; // Configuration const config = { collectionId: 'section_engagement', sections: [ { id: 'hero', name: 'Hero + Stats', selector: '.hero, [class*="hero"]' }, { id: 'honest-check', name: '報讀前問自己', selector: '[class*="honest"]' }, { id: 'four-advantages', name: '四大核心優勢', selector: '[class*="advantage"]' }, { id: 'course-content', name: '理論實戰並重', selector: '[class*="course"], [class*="content"]' }, { id: 'live-practice', name: '實戰練習', selector: '[class*="practice"], [class*="live"]' }, { id: 'graduation', name: '畢業成果', selector: '[class*="graduate"], [class*="graduation"]' }, { id: 'outcomes', name: '課程成果', selector: '[class*="outcome"]' }, { id: 'testimonials', name: '學員真實分享', selector: '[class*="testimonial"]' }, { id: 'schedule', name: '開班時間', selector: '[class*="schedule"], [class*="time"]' }, { id: 'faq', name: '常見問題', selector: '[class*="faq"], [class*="question"]' } ], flushInterval: 30000 // Send data every 30 seconds }; // Track state const state = { sections: {}, pendingData: [], flushTimer: null }; // Initialize section tracking state config.sections.forEach(section => { state.sections[section.id] = { name: section.name, timeSpent: 0, entered: 0, left: 0, lastEntered: null, isCurrentlyIn: false }; }); /** * Format date as YYYY-MM-DD */ function getDateString() { const now = new Date(); return now.toISOString().split('T')[0]; } /** * Get ISO timestamp */ function getTimestamp() { return new Date().toISOString(); } /** * Send data to Wix Collection */ async function sendDataToWix(data) { try { // Use Wix Data API to insert item const response = await fetch(`https://www.wixapis.com/v1/contacts/me`, { method: 'GET', headers: { 'Authorization': wixLocation.authorization } }); if (response.ok) { // If we can authenticate, send data const insertResponse = await fetch( `https://www.wixapis.com/wix-data/v2/items/${config.collectionId}`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': wixLocation.authorization }, body: JSON.stringify({ dataItem: { data: { section_id: data.sectionId, page_url: window.location.href, time_spent: data.timeSpent, button_clicks: data.buttonClicks || 0, last_updated: new Date().toISOString().split('T')[0], visitor_id: data.visitorId || 'anonymous' } } }) } ); if (insertResponse.ok) { console.log('✅ Tracking data sent to Wix:', data); } else { console.warn('⚠️ Failed to send tracking data to Wix:', insertResponse.status); } } } catch (error) { console.warn('⚠️ Could not send to Wix API:', error.message); // Fallback: store in localStorage as backup saveToLocalStorage(data); } } /** * Fallback: save to localStorage */ function saveToLocalStorage(data) { try { const key = 'hkild_user_behavior'; const existing = JSON.parse(localStorage.getItem(key) || '{}'); const today = getDateString(); if (!existing[today]) { existing[today] = { sections: {}, buttonClicks: [] }; } // Update section data existing[today].sections[data.sectionId] = { timeSpent: data.timeSpent, entered: data.entered, left: data.left }; localStorage.setItem(key, JSON.stringify(existing)); } catch (e) { console.warn('localStorage not available:', e); } } /** * Flush pending data to Wix */ async function flushData() { if (state.pendingData.length === 0) return; const dataToSend = [...state.pendingData]; state.pendingData = []; for (const data of dataToSend) { await sendDataToWix(data); // Small delay between requests await new Promise(resolve => setTimeout(resolve, 100)); } } /** * Record section entry */ function recordSectionEntry(sectionId) { if (!state.sections[sectionId]) return; const section = state.sections[sectionId]; section.entered++; section.lastEntered = Date.now(); section.isCurrentlyIn = true; console.log(`📍 Entered: ${section.name}`); } /** * Record section exit */ function recordSectionExit(sectionId) { if (!state.sections[sectionId]) return; const section = state.sections[sectionId]; if (section.lastEntered) { const elapsed = Math.round((Date.now() - section.lastEntered) / 1000); section.timeSpent += elapsed; section.left++; console.log(`📍 Exited: ${section.name} (${elapsed}s)`); } section.isCurrentlyIn = false; // Queue data to send const dataToSend = { date: getDateString(), sectionId: sectionId, sectionName: section.name, timeSpent: section.timeSpent, entered: section.entered, left: section.left, timestamp: getTimestamp() }; state.pendingData.push(dataToSend); } /** * Record button click in section */ function recordButtonClick(sectionId, buttonText) { const dataToSend = { date: getDateString(), sectionId: sectionId, sectionName: state.sections[sectionId]?.name || 'Unknown', buttonText: buttonText, timestamp: getTimestamp() }; state.pendingData.push(dataToSend); console.log(`🔘 Button clicked in ${sectionId}: ${buttonText}`); } /** * Setup Intersection Observer for section tracking */ function setupIntersectionObserver() { const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { recordSectionEntry(entry.target.dataset.sectionId); } else { recordSectionExit(entry.target.dataset.sectionId); } }); }, { threshold: 0.1 // Trigger when 10% of section is visible }); // Observe all sections config.sections.forEach(section => { const elements = document.querySelectorAll(section.selector); elements.forEach(el => { el.dataset.sectionId = section.id; observer.observe(el); }); }); console.log('✅ Intersection Observer initialized'); } /** * Setup button click tracking */ function setupButtonTracking() { document.addEventListener('click', (event) => { const button = event.target.closest('button, a[role="button"]'); if (!button) return; // Find which section this button is in let section = button.closest('[data-section-id]'); if (section) { const sectionId = section.dataset.sectionId; const buttonText = button.textContent.trim().substring(0, 50); recordButtonClick(sectionId, buttonText); } }, true); console.log('✅ Button tracking initialized'); } /** * Initialize everything */ function initialize() { console.log('🚀 HKILD Tracking Initialized'); // Setup observers setupIntersectionObserver(); setupButtonTracking(); // Auto-flush data periodically state.flushTimer = setInterval(flushData, config.flushInterval); // Flush on page unload window.addEventListener('beforeunload', flushData); // Expose for debugging window.hkildTracking = { getState: () => state, flushData: flushData, recordButtonClick: recordButtonClick, recordSectionEntry: recordSectionEntry, recordSectionExit: recordSectionExit }; } // Start when DOM is ready if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initialize); } else { initialize(); } })();
top of page

如何減少抽血時的疼痛?

  • 作家相片: admin
    admin
  • 2023年5月9日
  • 讀畢需時 2 分鐘

已更新:2023年5月22日


抽血技能
抽血

抽血是一種常見的醫療程序,但是採集過程中可能引起疼痛。下面是一些可能引起疼痛的原因:

  • 剌痛:當針頭穿過皮膚和其他組織時,可能會引起剌痛感。

  • 壓力:在採集過程中,可能需要對靜脈施加壓力以幫助血液流動,這可能會引起壓痛感。

  • 引起焦慮:採集過程可能會引起病人的焦慮和緊張感,進而增加疼痛感。

為了減輕血液採集時的疼痛,可以嘗試以下技巧和建議:

  • 分散注意力:試著轉移注意力,例如看書或聽音樂,以減輕對採集過程的關注,進而減少疼痛感。

  • 進行深呼吸:深呼吸可以幫助放鬆身體,減少緊張感,進而減少疼痛感。深呼吸可以通過控制呼吸,減少壓力和焦慮,進而幫助減輕疼痛感。

  • 聊天:和醫護人員聊天可以幫助轉移注意力,減少緊張感,進而減少疼痛感。此外,和朋友聊天或者進行一些輕度的活動,例如玩遊戲或者看電視,也可以幫助減輕疼痛感。

此外,還有一些不同的鎮痛方法,可以減少血液採集時的疼痛。例如:

  • 局部麻醉:這是一種在採集點施加局部麻醉藥物以減輕疼痛的方法。局部麻醉可通過麻醉局部區域來減輕疼痛感,一般適用於需要較長時間採集或者需要採集較多血液的病人。

  • 鎮靜劑:這是一種藥物,可以幫助病人放鬆和減少緊張感,進而減少疼痛感。鎮靜劑可以通過減輕緊張感和焦慮來幫助減輕疼痛感。

減輕血液採集時的疼痛可以提高病人的舒適度和病人滿意度。因此,醫護人員應該在採集過程中使用這些技巧和建議,並考慮使用不同的鎮痛方法,以幫助病人減輕疼痛感。此外,醫護人員還可以提供更多的支持和關懷,例如提供病人所需的照顧和安慰等,以幫助病人更好地應對血液採集時的疼痛。

留言


香港生命開展學會 Hong Kong institute of Life Development

E-mail: info@hkild.com  

Tel: 852- 6906 3436

Address: Unit C 13/F Nathan Tower, 518-520 Nathan Road, Kowloon

九龍油麻地彌敦道518-520號 (彌敦行) 13 樓 C 室

Stationary photo

©2013 by HKILD.  All Rights Reserved.

bottom of page