<!-- Google Tag Manager --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K6RL72N');</script><!-- Google Analytics 4 --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-3V50CTHZLC"></script> <script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','G-3V50CTHZLC');</script><!-- Meta Pixel --> <script>!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init','769123969110563');</script><!-- ChatGPT Pixel --> <script>(function(w,d,s,u){if(w.oaiq)return;var q=function(){q.q.push(arguments);};q.q=[];w.oaiq=q;var js=d.createElement(s);js.async=true;js.src=u;var f=d.getElementsByTagName(s)[0];f.parentNode.insertBefore(js,f);})(window,document,"script","https://bzrcdn.openai.com/sdk/oaiq.min.js");oaiq("init",{pixelId:"WZWKUs3KFbrKbv8xbuc54W",debug:false});</script><!-- TikTok Pixel --> <script>!function(w,d,t){w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var i="https://analytics.tiktok.com/i18n/pixel/events.js";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=i+"?sdkid="+e+"&lib="+t;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};ttq.load('DC4DQCBC77U0A5LSO2CG');ttq.page();}(window,document,'ttq');</script> <script> (function() { function setCookie(n,v,d){var e="";if(d){var dt=new Date;dt.setTime(dt.getTime()+24*60*60*1e3*d);e="; expires="+dt.toUTCString()}var domain=window.location.hostname.replace(/^www\./,'');document.cookie=n+"="+encodeURIComponent(v||"")+e+"; path=/; domain=."+domain+"; SameSite=Lax";} function getCookie(n){var ne=n+"=",ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" ")c=c.substring(1,c.length);if(c.indexOf(ne)==0){try{return decodeURIComponent(c.substring(ne.length,c.length))}catch(err){return c.substring(ne.length,c.length)}}}return null}// Helper: Parse nilai cookie GA4 (mendukung format baru GS2. & lama GS1.) function parseGaCookieValue(val) { if (!val) return null; if (val.indexOf('GS2.') === 0) { var matchSid = val.match(/s(\d+)/); var matchSno = val.match(/$o(\d+)/); if (matchSid) { return { session_id: matchSid[1], session_number: matchSno ? matchSno[1] : null }; } } if (val.indexOf('GS1.') === 0) { var parts = val.split('.'); if (parts.length >= 4) { return { session_id: parts[2], session_number: parts[3] }; } } return null; }// Helper: Ekstraksi GA4 Session ID & Session Number terkunci ke Measurement ID aktif function getGaSessionData() { var activeGa4 = 'G-3V50CTHZLC'; var targetCookie = activeGa4 ? ('_ga_' + activeGa4.replace(/^G-/i, '')) : ''; var cookies = document.cookie.split(';');if (targetCookie) { for (var i = 0; i < cookies.length; i++) { var c = cookies[i].trim(); if (c.indexOf(targetCookie + '=') === 0) { var parsed = parseGaCookieValue(c.substring(targetCookie.length + 1)); if (parsed) return parsed; } } }if (!targetCookie) { for (var j = 0; j < cookies.length; j++) { var cj = cookies[j].trim(); if (cj.indexOf('_ga_') === 0) { var eqIdx = cj.indexOf('='); if (eqIdx !== -1) { var parsedFb = parseGaCookieValue(cj.substring(eqIdx + 1)); if (parsedFb) return parsedFb; } } } } return { session_id: null, session_number: null }; }var urlP = new URLSearchParams(window.location.search); if(urlP.get('gclid')) setCookie('dja_gclid_saved', urlP.get('gclid'), 30); if(urlP.get('ttclid')) setCookie('dja_ttclid_saved', urlP.get('ttclid'), 30); if(urlP.get('fbclid')) { setCookie('dja_fbclid_saved', urlP.get('fbclid'), 30); if(!getCookie('dja_fbclid_time')) setCookie('dja_fbclid_time', Date.now(), 30); }// Simpan UTM ke cookie agar bertahan dari halaman landing -> checkout -> invoice ['utm_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'].forEach(function(k) { var v = urlP.get(k); if (v) setCookie('dja_' + k, v, 30); });function getUtmParam(k) { return urlP.get(k) || getCookie('dja_' + k) || ''; }async function initAdvancedMatching() { var userId = urlP.get('id'); if (userId && window.crypto && crypto.subtle) { try { const msgBuffer = new TextEncoder().encode(userId.trim().toLowerCase()); const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer); const hashHex = Array.from(new Uint8Array(hashBuffer)).map(b => b.toString(16).padStart(2, '0')).join(''); if (typeof oaiq === 'function' && 'WZWKUs3KFbrKbv8xbuc54W') oaiq('init', { pixelId: 'WZWKUs3KFbrKbv8xbuc54W', user: { external_id_sha256: hashHex } }); if (typeof fbq === 'function' && '769123969110563') fbq('init', '769123969110563', { external_id: hashHex }); if (typeof ttq === 'function' && 'DC4DQCBC77U0A5LSO2CG') ttq.identify({ external_id: hashHex }); } catch(e) {} } }document.addEventListener('DOMContentLoaded', function() { initAdvancedMatching();const path = window.location.pathname; const title = document.title; let campSlug = 'general-donation';const regexStr = "\/campaign\/([^\/]+)"; const slugMatch = path.match(new RegExp(regexStr)); if (slugMatch && slugMatch[1]) { campSlug = slugMatch[1]; }try { if (typeof oaiq === 'function' && !path.includes('invoice')) { oaiq("measure", "page_viewed", { type: "contents", contents: [{ id: campSlug, name: title, content_type: "page" }] }); }if (!path.includes('invoice')) { if (path.includes('donate-now')) { if (typeof fbq === 'function') fbq('track', 'AddToCart', { content_name: title, content_ids: [campSlug], content_type: 'product', value: 0, currency: 'IDR' }); if (typeof gtag === 'function') gtag('event', 'add_to_cart', { items: [{ item_name: title, item_id: campSlug, price: 0 }] }); if (typeof oaiq === 'function') oaiq("measure", "items_added", { type: "contents", contents: [{ id: campSlug, name: title, content_type: "product" }] }); if (typeof ttq === 'function') ttq.track('AddToCart', { contents: [{ content_id: campSlug, content_name: title, content_type: 'product', quantity: 1, price: 0 }], value: 0, currency: 'IDR' }); } else if (path.includes('campaign')) { if (typeof fbq === 'function') fbq('track', 'ViewContent', { content_name: title, content_ids: [campSlug], content_type: 'product' }); if (typeof gtag === 'function') gtag('event', 'view_item', { items: [{ item_name: title, item_id: campSlug, price: 0 }] }); if (typeof oaiq === 'function') oaiq("measure", "contents_viewed", { type: "contents", contents: [{ id: campSlug, name: title, content_type: "product" }] }); if (typeof ttq === 'function') ttq.track('ViewContent', { contents: [{ content_id: campSlug, content_name: title, content_type: 'product', quantity: 1, price: 0 }], value: 0, currency: 'IDR' }); } } } catch(e) {}// SUNTIK UTM KE WHATSAPP const utmId = getUtmParam('utm_id'); const utmCampaign = getUtmParam('utm_campaign'); const utmContent = getUtmParam('utm_content'); const utmTerm = getUtmParam('utm_term'); const utmSource = getUtmParam('utm_source');let utmString = ""; if (utmId) utmString += " #ID-" + utmId; if (utmCampaign) utmString += " #CP-" + utmCampaign; if (utmContent) utmString += " #CT-" + utmContent; if (utmTerm) utmString += " #TM-" + utmTerm; if (utmSource) utmString += " #SR-" + utmSource;if (utmString !== "") { const waLinks = document.querySelectorAll('a[href*="wa.me"], a[href*="api.whatsapp.com"]'); waLinks.forEach(function(link) { let originalHref = link.getAttribute('href'); if (originalHref.includes('?text=')) { link.setAttribute('href', originalHref + encodeURIComponent(utmString)); } else { link.setAttribute('href', originalHref + '?text=' + encodeURIComponent("Halo Fora, saya mau donasi!" + utmString)); } }); }// TRACKING WA FLOAT var waFloatBtn = document.querySelector('.whatsapp-float'); if (waFloatBtn) { waFloatBtn.addEventListener('click', function() { try { if (typeof fbq === 'function') fbq('track', 'Lead', { content_name: title, action_source: 'website' }); if (typeof gtag === 'function') gtag('event', 'generate_lead', { method: 'WhatsApp', item_id: campSlug }); if (typeof ttq === 'function') ttq.track('Contact', { contents: [{ content_id: campSlug, content_name: title, content_type: 'product', quantity: 1, price: 0 }], value: 0, currency: 'IDR' }); window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'whatsapp_lead', 'campaign_slug': campSlug }); } catch(e) {} }); }// MONITOR INVOICE & SEND TO BUNKER var lastReportedInv = ''; var reportTimer = null;setInterval(function() { var currURL = window.location.href; var match = currURL.match(/(INV-[A-Z0-9]+)/i);if (match && match[1].toUpperCase() !== lastReportedInv) { var invID = match[1].toUpperCase(); lastReportedInv = invID;if (getCookie('dja_tracked_' + invID)) return; if (reportTimer) clearTimeout(reportTimer); var trackAmount = typeof amount !== 'undefined' ? Number(amount) || 0 : 0;reportTimer = setTimeout(function() { setCookie('dja_tracked_' + invID, 'yes', 1);// 1. Tag Checkout Dimulai (dengan event_id = invID untuk deduplikasi) if (typeof fbq === 'function') fbq('track', 'InitiateCheckout', { content_ids: [campSlug], content_type: 'product', value: trackAmount, currency: 'IDR' }, { eventID: invID }); if (typeof gtag === 'function') gtag('event', 'begin_checkout', { transaction_id: invID, value: trackAmount, currency: 'IDR', items: [{ item_name: title, item_id: campSlug, price: trackAmount }] }); if (typeof oaiq === 'function') oaiq("measure", "checkout_started", { type: "contents", amount: parseInt(trackAmount), currency: "IDR", contents: [{ id: campSlug, name: title, content_type: "product" }] }, { event_id: invID }); if (typeof ttq === 'function') ttq.track('InitiateCheckout', { contents: [{ content_id: campSlug, content_name: title, content_type: 'product', quantity: 1, price: trackAmount }], value: trackAmount, currency: 'IDR' }, { event_id: invID });// 2. Deteksi Cerdas Halaman Invoice Lunas (Hybrid Deduplikasi GA4 & TikTok Web Tag) var bodyText = document.body ? (document.body.innerText || '') : ''; var isPaidStatus = /status[:\s]+(lunas|berhasil|sukses)|pembayaran\s+(berhasil|diterima)|terima\s+kasih/i.test(bodyText);if (isPaidStatus && !getCookie('dja_paid_web_' + invID)) { setCookie('dja_paid_web_' + invID, 'yes', 30); if (typeof gtag === 'function') { gtag('event', 'purchase', { transaction_id: invID, value: trackAmount, currency: 'IDR', items: [{ item_name: title, item_id: campSlug, price: trackAmount }] }); } // TikTok Browser Purchase dengan event_id identik (deduplikasi otomatis dg Events API 2.0) if (typeof ttq === 'function') { ttq.track('Purchase', { contents: [{ content_id: campSlug, content_name: title, content_type: 'product', quantity: 1, price: trackAmount }], value: trackAmount, currency: 'IDR' }, { event_id: invID }); } }// 3. Ambil data sesi GA4 terbaru & kirim ke Bunker (1.5 detik + keepalive) var gaSession = getGaSessionData();var data = { gclid: getCookie('dja_gclid_saved'), ttclid: getCookie('dja_ttclid_saved'), ttp: getCookie('_ttp'), fbclid: getCookie('dja_fbclid_saved'), fbclid_time: getCookie('dja_fbclid_time'), fbc: getCookie('_fbc'), fbp: getCookie('_fbp'), obref: getCookie('__obref'), ua: navigator.userAgent, cid: getCookie('_ga'), sid: gaSession.session_id, sno: gaSession.session_number, slug: campSlug, utm_campaign: getUtmParam('utm_campaign') || null, utm_source: getUtmParam('utm_source') || null, utm_medium: getUtmParam('utm_medium') || null };var fd = new FormData(); fd.append('action', 'dja_save_tracking_ajax'); fd.append('invoice_id', invID); fd.append('tracking_data', JSON.stringify(data)); fetch('https://forhumanity.id/wp-admin/admin-ajax.php', { method: 'POST', body: fd, keepalive: true });}, 1500); } }, 1000); }); })(); </script>

Galang dana# Satu klik, satu nyawa tertolong

KENCLENG DONASI ONLINE

Sedikit Bagi Kita, Sangat Berarti Bagi Mereka. Sisihkan Rp10.000 untuk Menebar Senyum Sesama.

Aksi #ForHumanity
Impact #ForHumanity

Temukan dan Hubungi Kami di :

© For Humanity. All rights reserved