How to Become a Yoga Therapist What Is Yoga Therapy? Yoga treatment is the most well-known approach to empowering individuals to progress toward additional created prosperity and success through the use of the illustrations and practices of Yoga. Yoga treatment is the utilization of yoga practices to alleviate physical and mental health conditions with the […]
What is Licensed Professional Counselor Licensed Professional Counselor (LPC) is a psychological well-being proficient who helps clients with working on their psychological and profound wellbeing, while at the same time revising negative ways of behaving and creating positive ways of behaving in their place. A LPC can work in various wellbeing associations and with various […]
end), or any
* header/footer scripts plugin. One copy per site. No dependencies.
*/
(function () {
'use strict';
var COOKIE = 'cc_lead_source';
var DAYS = 90; // first-touch memory window
var SITE_HOST = location.hostname.replace(/^www\./, '');
// Hidden-field IDs expected on the Elementor forms (Advanced > Field ID).
var FIELDS = ['lead_channel', 'utm_source', 'utm_medium', 'utm_campaign',
'utm_term', 'utm_content', 'referrer', 'landing_page', 'gclid'];
var AI_HOSTS = [
'chatgpt.com', 'chat.openai.com', 'openai.com',
'perplexity.ai', 'pplx.ai',
'gemini.google.com', 'bard.google.com',
'copilot.microsoft.com', 'bing.com/chat',
'claude.ai', 'anthropic.com',
'you.com', 'poe.com', 'meta.ai', 'grok.com', 'x.ai',
'chat.mistral.ai', 'mistral.ai', 'deepseek.com', 'chat.deepseek.com',
'character.ai', 'huggingface.co', 'phind.com', 'komo.ai', 'andisearch.com',
'search.brave.com/ask', 'duckduckgo.com/?q=&ia=chat'
];
var SEARCH_HOSTS = ['google.', 'bing.com', 'yahoo.', 'duckduckgo.com', 'ecosia.org',
'yandex.', 'baidu.com', 'search.brave.com', 'startpage.com', 'aol.com'];
var SOCIAL_HOSTS = ['facebook.com', 'fb.com', 'l.facebook.com', 'lm.facebook.com', 'instagram.com',
'l.instagram.com', 'linkedin.com', 'lnkd.in', 't.co', 'twitter.com', 'x.com',
'tiktok.com', 'youtube.com', 'youtu.be', 'pinterest.', 'reddit.com',
'threads.net', 'snapchat.com', 'nextdoor.com'];
function qs(name) {
var m = new RegExp('[?&]' + name + '=([^]*)').exec(location.search);
return m ? decodeURIComponent(m[1].replace(/\+/g, ' ')).slice(0, 200) : '';
}
function hostOf(url) {
try { return new URL(url).hostname.replace(/^www\./, ''); } catch (e) { return ''; }
}
function matches(url, list) {
var h = hostOf(url), full = url.replace(/^https?:\/\/(www\.)?/, '');
for (var i = 0; i < list.length; i++) {
if (list[i].indexOf('/') > -1 ? full.indexOf(list[i]) === 0 : (h === list[i] || h.slice(-(list[i].length + 1)) === '.' + list[i] || h.indexOf(list[i]) === 0)) return true;
}
return false;
}
function readCookie() {
var m = document.cookie.match(new RegExp('(?:^|; )' + COOKIE + '=([^;]*)'));
if (!m) return null;
try { return JSON.parse(decodeURIComponent(m[1])); } catch (e) { return null; }
}
function writeCookie(obj) {
var d = new Date(); d.setTime(d.getTime() + DAYS * 864e5);
document.cookie = COOKIE + '=' + encodeURIComponent(JSON.stringify(obj)) +
'; expires=' + d.toUTCString() + '; path=/; domain=.' + SITE_HOST + '; SameSite=Lax; Secure';
}
function classify(d) {
var src = (d.utm_source || '').toLowerCase();
var med = (d.utm_medium || '').toLowerCase();
var ref = d.referrer || '';
// 1. Campaign-tagged traffic and ad click IDs win.
if (d.gclid || /^(cpc|ppc|paid|paidsearch|sem)$/.test(med)) return 'Paid Search';
if (d.fbclid || /^(paid[-_ ]?social|paid_social|social[-_]?paid)$/.test(med)) return 'Paid Social';
if (/^(ai|llm|chatgpt|perplexity)$/.test(med) || /chatgpt|perplexity|gemini|copilot|claude/.test(src)) return 'AI';
if (/^e?mail$|newsletter/.test(med)) return 'Email';
if (/^social$/.test(med)) return 'Organic Social';
if (/^(organic|gbp|local)$/.test(med)) return 'Organic Search';
if (/^(referral|partner|directory)$/.test(med)) return 'Referral';
if (/^sms|text$/.test(med)) return 'SMS';
if (src || med) return 'Campaign: ' + (med || src);
// 2. Otherwise classify by referrer.
if (!ref) return 'Direct';
if (matches(ref, AI_HOSTS)) return 'AI';
if (matches(ref, SEARCH_HOSTS)) return 'Organic Search';
if (matches(ref, SOCIAL_HOSTS)) return 'Organic Social';
return 'Referral';
}
// Build or reuse the first-touch record.
var data = readCookie();
var ref = document.referrer || '';
var isInternal = ref && hostOf(ref) === SITE_HOST;
var hasParams = !!(qs('utm_source') || qs('utm_medium') || qs('gclid') || qs('fbclid'));
if (!data || hasParams) { // first visit, or a new tagged entry overrides
data = {
utm_source: qs('utm_source'),
utm_medium: qs('utm_medium'),
utm_campaign: qs('utm_campaign'),
utm_term: qs('utm_term'),
utm_content: qs('utm_content'),
gclid: qs('gclid') || qs('gbraid') || qs('wbraid'),
fbclid: qs('fbclid'),
referrer: isInternal ? '' : ref.slice(0, 300),
landing_page: (location.origin + location.pathname).slice(0, 300),
first_seen: new Date().toISOString().slice(0, 10)
};
data.lead_channel = classify(data);
writeCookie(data);
}
window.ccLeadSource = data; // available to GTM / other scripts
// Fill hidden fields on every form (Elementor and plain HTML).
function fill(root) {
FIELDS.forEach(function (f) {
var val = data[f] || '';
var inputs = (root || document).querySelectorAll(
'input[name="form_fields[' + f + ']"], input[name="' + f + '"], #form-field-' + f);
for (var i = 0; i < inputs.length; i++) inputs[i].value = val;
});
}
function init() {
fill(document);
// Forms injected later (popups, lazy sections)
if (window.MutationObserver) {
new MutationObserver(function (muts) {
for (var i = 0; i < muts.length; i++) if (muts[i].addedNodes.length) { fill(document); break; }
}).observe(document.body, { childList: true, subtree: true });
}
// Push to dataLayer for GTM / GA4 user properties if desired
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'cc_lead_source_ready', lead_channel: data.lead_channel,
lead_utm_source: data.utm_source, lead_utm_medium: data.utm_medium,
lead_utm_campaign: data.utm_campaign, lead_landing_page: data.landing_page });
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init); else init();
})();