/* === Defer HubSpot + Facebook until window.load === */
(function() {
/* ── 1. HubSpot deferral ─────────────────────────────────────────────────
HubSpot IIFE: if (document.getElementById('hs-analytics')) { return; }
We intercept that check and force it to exit early.
After load, restore getElementById and re-run HubSpot properly. */
var _hsBlocked = false;
var _origGetById = document.getElementById.bind(document);
document.getElementById = function(id) {
if (id === 'hs-analytics') {
_hsBlocked = true;
return { tagName: 'SCRIPT' }; /* truthy → HubSpot IIFE exits early */
}
return _origGetById(id);
};
window.addEventListener('load', function() {
document.getElementById = _origGetById; /* restore immediately */
if (_hsBlocked) {
/* We successfully deferred it — now load HubSpot for real */
(function(d, s, i, r) {
if (d.getElementById(i)) { return; }
var n = d.createElement(s), e = d.getElementsByTagName(s)[0];
n.id = i;
n.src = '//js.hs-analytics.net/analytics/' +
(Math.ceil(new Date() / r) * r) + '/' + 3944609 + '.js';
e.parentNode.insertBefore(n, e);
})(document, 'script', 'hs-analytics', 300000);
}
}, { once: true });
/* ── 2. Facebook Pixel deferral ──────────────────────────────────────────
Define window.fbq as a queue BEFORE GTM fires the Facebook Pixel tag.
GTM calls fbq('init', ...) and fbq('track','PageView').
After load, load the real fbevents.js and replay queued calls. */
if (!window.fbq) {
var _fbQueue = [];
var _fbLoaded = false;
window.fbq = function() {
_fbQueue.push(Array.prototype.slice.call(arguments));
};
window._fbq = window.fbq;
window.fbq.queue = _fbQueue;
window.fbq.version = '2.0';
window.fbq.loaded = false;
window.fbq.disablePushState = false;
window.fbq.allowDuplicatePageViews = false;
window.fbq.pixelRatio = 1;
window.addEventListener('load', function() {
if (_fbLoaded || _fbQueue.length === 0) { return; }
_fbLoaded = true;
/* Load real fbevents.js */
var fbScript = document.createElement('script');
fbScript.async = true;
fbScript.src = 'https://connect.facebook.net/en_US/fbevents.js';
fbScript.onload = function() {
/* Replay all queued calls with the real fbq */
if (window.fbq && window.fbq !== window._fbq) {
_fbQueue.forEach(function(args) {
window.fbq.apply(null, args);
});
}
};
document.head.appendChild(fbScript);
}, { once: true });
}
})();
Skip to content
Content Shifu
สื่อ สถาบันฝึกอบรม และแหล่งความรู้ชั้นนำของไทยในเรื่อง Marketing & Technology
เมื่อ 'ความเก่ง' อย่างเดียวไม่พอ เจาะลึกกลยุทธ์บริหารพลังงาน, การใช้ AI เพิ่มศักยภาพ และทักษะที่องค์กรต้องการ เพื่อเปลี่ยนคุณให้เป็น 'ตัวจริง' ที่สร้างผลลัพธ์ได้มากกว่าเดิม สรุปจากงาน PPC2026
Our Services
เรียน Digital Marketing แบบใช้งานได้จริงกับ Content Shifu
สร้าง Authority และเก็บ Qualified Leads ให้กับธุรกิจของคุณ
อัปเดตความรู้ พบปะและรับพลังบวกจากคนในแวดวงการตลาด
Getting Started
นี่คือจุดสุดท้ายของหน้านี้ แต่เป็นจุดเริ่มต้นการเรียนรู้ของคุณกับ Content Shifu 😉