Vagas de Emprego no Mercado Livre em 2026: Como se Candidatar
<linearGradient id="sl-pl-stream-svg-grad01" linear-gradient(90deg, #ff8c59, #ffb37f 24%, #a3bf5f 49%, #7ca63a 75%, #527f32)
A g u a r d e . . .
O Mercado Livre é a maior empresa de tecnologia e e-commerce da América Latina. Além disso, é um dos empregadores que mais cresce no Brasil. Por isso, trabalhar nessa empresa é uma oportunidade valiosa para profissionais de tecnologia, logística, finanças e muito mais. Neste guia, você encontra tudo sobre as vagas disponíveis em 2026.
📦 Mercado Livre
Descubra os requisitos e benefícios das vagas no Mercado Livre.
Conheça as exigências, vantagens oferecidas pela empresa e veja se as oportunidades combinam com o seu perfil.
✓ Benefícios
✓ Requisitos
✓ Guia completo
Ver guia do Mercado Livre
→ continuação
→
🏁 COMO SE CANDIDATAR Guia completo de candidatura Veja o passo a passo para garantir sua vaga. CANDIDATAR-SE AGORA → Você continuará em nosso site
O Mercado Livre tem centros de distribuição, escritórios e equipes em todo o Brasil. Portanto, as oportunidades de emprego alcançam diversas regiões do país. Além disso, a empresa cresce ano após ano, gerando novas vagas com frequência. Por isso, vale acompanhar o portal de carreiras regularmente.
Sobre o Mercado Livre O Mercado Livre foi fundado em 1999 na Argentina. Hoje, é a empresa de tecnologia mais valiosa da América Latina. Além disso, opera em 18 países, com o Brasil sendo seu maior mercado. Por isso, grande parte das vagas da empresa está concentrada aqui.
A empresa oferece duas plataformas principais: o Mercado Livre, para compra e venda online, e o Mercado Pago, para serviços financeiros. Dessa forma, há oportunidades tanto na área de e-commerce quanto em fintech. Além disso, a unidade de logística Mercado Envios gera muitas vagas operacionais. Por outro lado, o ambiente de trabalho é jovem, dinâmico e muito orientado à tecnologia.
Para saber mais sobre o mercado de trabalho no Brasil em 2026, acesse nossa página de Vagas de Emprego no Brasil .
Principais Áreas que Contratam no Mercado Livre O Mercado Livre contrata para muitas áreas diferentes. Por isso, há espaço para perfis técnicos, comerciais, operacionais e corporativos.
Tecnologia e Produto Tecnologia é o coração do Mercado Livre. Por isso, essa é a área que mais contrata e que oferece os salários mais competitivos. Os cargos mais buscados incluem:
Desenvolvedor(a) de software (back-end, front-end e mobile) Engenheiro(a) de dados e cientista de dados Product manager e product designer Analista de segurança da informação Engenheiro(a) de machine learning Além disso, a empresa tem squads autônomos e um ambiente muito próximo do modelo das startups. Por isso, quem gosta de inovar e trabalhar com metodologias ágeis se identifica muito com a cultura da empresa.
Logística e Operações O Mercado Envios é uma das operações logísticas que mais crescem no Brasil. Por isso, há muitas vagas para perfis operacionais em todo o país. Os cargos mais frequentes são:
Separador(a) e conferente de mercadorias Operador(a) de logística Motorista entregador(a) Coordenador(a) de operações Analista de supply chain Por outro lado, os turnos são rotativos nos centros de distribuição. Portanto, a disponibilidade de horário é fundamental para essas posições.
Mercado Pago e Finanças O Mercado Pago é a fintech do grupo. Assim, ela gera muitas vagas na área financeira e de serviços digitais. As posições mais comuns incluem:
Analista financeiro Especialista em meios de pagamento Analista de crédito e risco Consultor(a) comercial de contas Além disso, profissionais de compliance e regulatório também são muito procurados. Por isso, quem tem formação em direito, economia ou finanças encontra boas oportunidades nessa unidade.
Comercial e Marketing A área comercial do Mercado Livre é bastante ativa. Por isso, há vagas para profissionais que trabalham com grandes contas, campanhas e crescimento de sellers. Os cargos mais procurados são:
Key account manager Analista de marketing digital Especialista em growth Gerente de categoria Quer entender quais são os benefícios oferecidos? Confira nosso guia de Benefícios e Salários das Principais Vagas de Emprego .
Cultura e Valores do Mercado Livre O Mercado Livre tem uma cultura forte e bem definida. Por isso, conhecê-la é essencial para o processo seletivo. A empresa valoriza:
Foco no usuário: todas as decisões começam pela experiência do clienteInovação constante: busca por soluções criativas e disruptivasTrabalho em equipe: colaboração entre diferentes áreas e paísesDiversidade e inclusão: compromisso ativo com equipes diversasAlta performance: entrega de resultados mensuráveis e significativosAlém disso, o ambiente de trabalho é predominantemente em modelo híbrido. Por isso, a flexibilidade é uma das características mais apreciadas pelos colaboradores. Por outro lado, o ritmo é intenso e exige muita proatividade.
Dicas para se Destacar nas Seleções Concorrer a uma vaga no Mercado Livre exige preparação específica. Assim, veja as principais dicas para ter sucesso.
Em primeiro lugar, construa um portfólio ou histórico de resultados concretos para apresentar na entrevista. Em segundo lugar, demonstre domínio de ferramentas e linguagens relevantes para o cargo desejado. Por fim, mostre que você conhece o produto e os desafios da empresa, pois isso impressiona os recrutadores.
Para entender melhor o que as empresas exigem dos candidatos, leia nosso guia de Requisitos das Vagas de Emprego .
Perguntas Frequentes O Mercado Livre tem vagas fora de São Paulo? Sim. Além da sede em São Paulo, a empresa tem centros de distribuição e escritórios em vários estados. Por isso, há oportunidades em diversas regiões do país.
O Mercado Livre contrata pessoas sem experiência? Para vagas operacionais, sim. Por outro lado, cargos de tecnologia e negócios geralmente exigem experiência comprovada na área.
O trabalho é presencial ou remoto? A maioria dos cargos corporativos segue o modelo híbrido. Portanto, você trabalhará alguns dias no escritório e outros dias em casa.
Como se candidatar às vagas? Acesse nosso guia completo de candidatura para ver o passo a passo detalhado.
Saiba mais:
// 3. Ajuste o GA4_ID abaixo
// ============================================================(function () {
"use strict";// ===================== CONFIGURACAO =====================
const CONFIG = {
GA4_ID: "G-GPNMCQ6RVR", // <-- SUBSTITUA PELO SEU ID GA4
DEBUG: false, // true = loga eventos no console
SCROLL_THRESHOLDS: [25, 50, 75, 100],
TIME_THRESHOLDS: [30, 60, 120, 180, 300],
PAGE_DEPTH_THRESHOLDS: [3, 5, 10, 20],
IDLE_TIMEOUT: 60000, // 60s
CTA_KEYWORDS: ["contato", "mentoria", "agendar", "comprar", "assinar", "cadastrar", "download", "baixar", "whatsapp"],
CHECKOUT_KEYWORDS: ["checkout", "hotmart", "eduzz", "pay", "compra", "pagamento"],
SOCIAL_DOMAINS: ["instagram.com", "facebook.com", "linkedin.com", "twitter.com", "x.com", "youtube.com", "telegram.org", "t.me"],
};// ===================== UTILIDADES =====================
const visitorId = getOrCreateVisitorId();
const sessionData = getSessionData();
const scoreData = getScoreData();
const firedEvents = new Set();function send(eventName, params = {}) {
params.visitor_id = visitorId;
if (CONFIG.DEBUG) console.log(`[LTV] ${eventName}`, params);
if (typeof gtag === "function") {
gtag("event", eventName, params);
}
}function sendOnce(eventName, key, params = {}) {
const uid = key || eventName;
if (firedEvents.has(uid)) return;
firedEvents.add(uid);
send(eventName, params);
}function getOrCreateVisitorId() {
let id = localStorage.getItem("ltv_visitor_id");
if (!id) {
id = "v_" + Math.random().toString(36).substr(2, 12) + "_" + Date.now();
localStorage.setItem("ltv_visitor_id", id);
}
return id;
}function getSessionData() {
let data = JSON.parse(sessionStorage.getItem("ltv_session") || "null");
if (!data) {
data = { page_count: 0, ads_seen: 0, ad_clicked: false, start: Date.now(), cta_clicked: false };
}
data.page_count++;
sessionStorage.setItem("ltv_session", JSON.stringify(data));
return data;
}function getScoreData() {
let data = JSON.parse(localStorage.getItem("ltv_score") || "null");
if (!data) {
data = {
score: 0,
total_sessions: 0,
total_pages: 0,
first_visit: new Date().toISOString(),
clusters: {},
days_active: [],
};
}
data.total_pages++;
const today = new Date().toISOString().slice(0, 10);
if (!data.days_active.includes(today)) {
data.days_active.push(today);
data.total_sessions++;
}
localStorage.setItem("ltv_score", JSON.stringify(data));
return data;
}function addScore(points) {
scoreData.score = Math.min(100, scoreData.score + points);
localStorage.setItem("ltv_score", JSON.stringify(scoreData));
}function getSegment() {
const s = scoreData.score;
if (s >= 70) return "hot";
if (s >= 40) return "warm";
if (s >= 15) return "interested";
return "cold";
}function getLifecycleStage() {
const days = scoreData.days_active.length;
const s = scoreData.score;
if (s >= 70 && days >= 5) return "advocate";
if (s >= 50) return "customer_intent";
if (days >= 3) return "engaged";
if (days >= 2) return "returning";
return "new";
}function getCluster() {
const path = location.pathname.toLowerCase();
const meta = document.querySelector('meta[property="article:section"],meta[name="category"]');
if (meta) return meta.content;
const parts = path.split("/").filter(Boolean);
return parts[0] || "home";
}function getUTM(param) {
return new URLSearchParams(location.search).get(param) || "";
}function getScrollPct() {
const h = document.documentElement.scrollHeight - window.innerHeight;
return h > 0 ? Math.round((window.scrollY / h) * 100) : 0;
}function getWordCount() {
const el = document.querySelector("article, .post-content, .entry-content, main");
return el ? el.innerText.split(/\s+/).length : 0;
}function isPost() {
return !!document.querySelector("article, .post-content, .entry-content");
}const cluster = getCluster();
const source = getUTM("utm_source") || document.referrer ? new URL(document.referrer || location.href).hostname : "direct";
const medium = getUTM("utm_medium") || "organic";
const campaign = getUTM("utm_campaign") || "";
const pageStart = Date.now();
let maxScroll = 0;
let lastActivity = Date.now();
let idleFired = false;// Atualizar cluster no score
scoreData.clusters[cluster] = (scoreData.clusters[cluster] || 0) + 1;
localStorage.setItem("ltv_score", JSON.stringify(scoreData));// ============================================================
// BLOCO 1: COMPORTAMENTO DE LEITURA (1-10)
// ============================================================// 1. ltv_visit
send("ltv_visit", {
source, medium, campaign, cluster,
page_count: sessionData.page_count,
is_returning: scoreData.total_sessions > 1,
});// 2. ltv_page_depth
CONFIG.PAGE_DEPTH_THRESHOLDS.forEach(function (depth) {
if (sessionData.page_count === depth) {
send("ltv_page_depth", { depth });
addScore(2);
}
});// 3. ltv_scroll_depth
const scrollFired = {};
window.addEventListener("scroll", function () {
const pct = getScrollPct();
maxScroll = Math.max(maxScroll, pct);
CONFIG.SCROLL_THRESHOLDS.forEach(function (t) {
if (pct >= t && !scrollFired[t]) {
scrollFired[t] = true;
send("ltv_scroll_depth", { depth: t, cluster });
if (t >= 75) addScore(3);
}
});
});// 4. ltv_time_engaged
CONFIG.TIME_THRESHOLDS.forEach(function (sec) {
setTimeout(function () {
send("ltv_time_engaged", { seconds: sec, cluster });
addScore(sec >= 120 ? 3 : 1);
}, sec * 1000);
});// 5. ltv_super_engaged
setTimeout(function () {
send("ltv_super_engaged", { seconds: 300, cluster });
addScore(5);
}, 300000);// 6. ltv_content_consumed
let contentConsumedCheck = setInterval(function () {
if (getScrollPct() >= 75 && (Date.now() - pageStart) > 30000) {
sendOnce("ltv_content_consumed", "content_consumed", {
title: document.title,
cluster,
word_count: getWordCount(),
});
addScore(5);
clearInterval(contentConsumedCheck);
}
}, 5000);// 7. ltv_paragraph_reached
if (typeof IntersectionObserver !== "undefined") {
const paragraphs = document.querySelectorAll("article p, .post-content p, .entry-content p, main p");
const totalP = paragraphs.length;
let lastP = 0;
if (totalP > 0) {
const pObserver = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
const idx = Array.from(paragraphs).indexOf(entry.target) + 1;
if (idx > lastP) {
lastP = idx;
if (idx % 5 === 0 || idx === totalP) {
send("ltv_paragraph_reached", {
last_paragraph: idx,
total_paragraphs: totalP,
pct_read: Math.round((idx / totalP) * 100),
});
}
}
}
});
}, { threshold: 0.6 });
paragraphs.forEach(function (p) { pObserver.observe(p); });
}
}// 8. ltv_heading_seen
if (typeof IntersectionObserver !== "undefined") {
const headings = document.querySelectorAll("article h2, article h3, main h2, main h3");
const hObserver = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
sendOnce("ltv_heading_seen", "h_" + entry.target.textContent.slice(0, 30), {
heading: entry.target.textContent.slice(0, 100),
tag: entry.target.tagName,
position: Math.round((entry.target.offsetTop / document.body.scrollHeight) * 100),
});
hObserver.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
headings.forEach(function (h) { hObserver.observe(h); });
}// 9. ltv_content_fatigue
let scrollSpeeds = [];
let lastScrollY = 0;
let lastScrollTime = Date.now();
window.addEventListener("scroll", function () {
const now = Date.now();
const dt = now - lastScrollTime;
if (dt > 500) {
const speed = Math.abs(window.scrollY - lastScrollY) / dt;
scrollSpeeds.push(speed);
lastScrollY = window.scrollY;
lastScrollTime = now;if (scrollSpeeds.length >= 10) {
const half = Math.floor(scrollSpeeds.length / 2);
const early = scrollSpeeds.slice(0, half).reduce(function (a, b) { return a + b; }, 0) / half;
const late = scrollSpeeds.slice(half).reduce(function (a, b) { return a + b; }, 0) / (scrollSpeeds.length - half);
if (early > 0 && late / early < 0.3) {
sendOnce("ltv_content_fatigue", "fatigue", {
scroll_pct: getScrollPct(),
early_speed: Math.round(early * 1000),
late_speed: Math.round(late * 1000),
});
}
}
}
});// 10. ltv_reread
let rereadCount = 0;
let prevScrollY = 0;
window.addEventListener("scroll", function () {
if (window.scrollY < prevScrollY - 300) {
rereadCount++;
send("ltv_reread", { from_pct: getScrollPct(), count: rereadCount });
}
prevScrollY = window.scrollY;
});// ============================================================
// BLOCO 2: QUALIDADE DE CONTEUDO (11-16)
// ============================================================// 11. ltv_image_view
if (typeof IntersectionObserver !== "undefined") {
const images = document.querySelectorAll("article img, main img, .post-content img");
const imgObserver = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
send("ltv_image_view", {
src: entry.target.src.slice(0, 200),
alt: (entry.target.alt || "").slice(0, 100),
});
imgObserver.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
images.forEach(function (img) { imgObserver.observe(img); });
}// 12. ltv_image_click
document.addEventListener("click", function (e) {
if (e.target.tagName === "IMG") {
send("ltv_image_click", {
src: e.target.src.slice(0, 200),
alt: (e.target.alt || "").slice(0, 100),
});
}
});// 13. ltv_list_engage
if (typeof IntersectionObserver !== "undefined") {
const lists = document.querySelectorAll("article ul, article ol, article table, main ul, main ol, main table");
lists.forEach(function (el) {
let timer = null;
const obs = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
timer = setTimeout(function () {
sendOnce("ltv_list_engage", "list_" + el.tagName + "_" + el.offsetTop, {
type: el.tagName.toLowerCase(),
items: el.children.length,
});
}, 3000);
} else {
if (timer) clearTimeout(timer);
}
});
}, { threshold: 0.5 });
obs.observe(el);
});
}// 14. ltv_word_count_vs_time
// (disparado no page_exit - bloco 12)// 15. ltv_reading_speed
setTimeout(function () {
const words = getWordCount();
const minutes = 1; // 60s
const wpm = Math.round(words * (getScrollPct() / 100) / minutes);
if (words > 100) {
send("ltv_reading_speed", {
wpm,
type: wpm > 400 ? "scanner" : wpm > 200 ? "normal" : "deep_reader",
});
}
}, 60000);// 16. ltv_anchor_click
document.addEventListener("click", function (e) {
const link = e.target.closest("a[href^='#']");
if (link) {
send("ltv_anchor_click", {
anchor: link.getAttribute("href"),
text: link.textContent.slice(0, 100),
});
}
});// ============================================================
// BLOCO 3: CONVERSAO/LEAD (17-27)
// ============================================================// 17. ltv_cta_click
document.addEventListener("click", function (e) {
const link = e.target.closest("a, button");
if (!link) return;
const text = (link.textContent || "").toLowerCase().trim();
const href = link.getAttribute("href") || "";
const isCTA = CONFIG.CTA_KEYWORDS.some(function (kw) { return text.includes(kw) || href.includes(kw); });
if (isCTA) {
send("ltv_cta_click", {
cta_text: link.textContent.trim().slice(0, 100),
cta_url: href.slice(0, 300),
cluster,
page_count: sessionData.page_count,
score_before: scoreData.score,
});
addScore(10);
sessionData.cta_clicked = true;
sessionStorage.setItem("ltv_session", JSON.stringify(sessionData));
}
});// 18. ltv_cta_hover
document.querySelectorAll("a, button").forEach(function (el) {
const text = (el.textContent || "").toLowerCase();
const isCTA = CONFIG.CTA_KEYWORDS.some(function (kw) { return text.includes(kw); });
if (isCTA) {
let hoverTimer = null;
el.addEventListener("mouseenter", function () {
hoverTimer = setTimeout(function () {
sendOnce("ltv_cta_hover", "hover_" + text.slice(0, 20), {
cta_text: el.textContent.trim().slice(0, 100),
hover_ms: 2000,
});
}, 2000);
});
el.addEventListener("mouseleave", function () {
if (hoverTimer) clearTimeout(hoverTimer);
});
}
});// 19. ltv_exit_intent
document.addEventListener("mouseout", function (e) {
if (e.clientY < 5) {
sendOnce("ltv_exit_intent", "exit_intent", {
time_on_page: Math.round((Date.now() - pageStart) / 1000),
scroll_pct: getScrollPct(),
score: scoreData.score,
pages: sessionData.page_count,
});
}
});// 20. ltv_lead_magnet_view
if (typeof IntersectionObserver !== "undefined") {
const magnets = document.querySelectorAll("[data-lead-magnet], .lead-magnet, .ebook-banner, .download-cta");
const magnetObs = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
sendOnce("ltv_lead_magnet_view", "magnet_" + entry.target.className, {
element: entry.target.className.slice(0, 100),
});
magnetObs.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
magnets.forEach(function (m) { magnetObs.observe(m); });
}// 21. ltv_lead_magnet_click
document.addEventListener("click", function (e) {
const link = e.target.closest("a");
if (!link) return;
const href = (link.getAttribute("href") || "").toLowerCase();
const text = (link.textContent || "").toLowerCase();
if (href.includes("download") || href.includes("ebook") || text.includes("download") || text.includes("baixar")) {
send("ltv_lead_magnet_click", {
text: link.textContent.trim().slice(0, 100),
url: href.slice(0, 300),
});
addScore(8);
}
});// 22. ltv_email_capture
document.addEventListener("input", function (e) {
if (e.target.type === "email" || e.target.name === "email") {
if (e.target.value.includes("@")) {
sendOnce("ltv_email_capture", "email_capture", { field: e.target.name || "email" });
addScore(15);
}
}
});// 23. ltv_whatsapp_intent
document.addEventListener("click", function (e) {
const link = e.target.closest("a[href*='wa.me'], a[href*='whatsapp']");
if (link) {
send("ltv_whatsapp_intent", {
url: link.href.slice(0, 300),
text: link.textContent.trim().slice(0, 100),
});
addScore(10);
}
});// 24. ltv_phone_reveal
document.addEventListener("click", function (e) {
const link = e.target.closest("a[href^='tel:']");
if (link) {
send("ltv_phone_reveal", { number: link.href.replace("tel:", "") });
addScore(8);
}
});// 25. ltv_calendar_click
document.addEventListener("click", function (e) {
const link = e.target.closest("a[href*='calendly'], a[href*='calendar'], a[href*='agenda']");
if (link) {
send("ltv_calendar_click", { url: link.href.slice(0, 300) });
addScore(12);
}
});// 26. ltv_form_start
document.addEventListener("focusin", function (e) {
const form = e.target.closest("form");
if (form && e.target.tagName === "INPUT") {
sendOnce("ltv_form_start", "form_start_" + (form.id || form.action), {
form_id: form.id || "unknown",
first_field: e.target.name || e.target.type,
});
}
});// 27. ltv_form_submit
document.addEventListener("submit", function (e) {
const form = e.target;
send("ltv_form_submit", {
form_id: form.id || "unknown",
form_action: (form.action || "").slice(0, 200),
cluster,
});
addScore(15);
});// ============================================================
// BLOCO 4: VENDA/PRODUTO (28-38)
// ============================================================// 28. ltv_product_view
const path = location.pathname.toLowerCase();
if (path.includes("mentoria") || path.includes("produto") || path.includes("curso") || path.includes("plano")) {
send("ltv_product_view", { product_page: path, source });
addScore(5);
}// 29. ltv_pricing_scroll
if (typeof IntersectionObserver !== "undefined") {
const pricingSections = document.querySelectorAll("[data-pricing], .pricing, .preco, .price, #pricing");
const pricingObs = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
sendOnce("ltv_pricing_scroll", "pricing_scroll", {
element: entry.target.className.slice(0, 100),
text: entry.target.textContent.slice(0, 200),
});
addScore(5);
pricingObs.unobserve(entry.target);// 30. ltv_pricing_time
setTimeout(function () {
sendOnce("ltv_pricing_time", "pricing_time", { seconds: 10 });
addScore(5);
}, 10000);
}
});
}, { threshold: 0.5 });
pricingSections.forEach(function (s) { pricingObs.observe(s); });
}// 31. ltv_checkout_intent
document.addEventListener("click", function (e) {
const link = e.target.closest("a, button");
if (!link) return;
const href = (link.getAttribute("href") || "").toLowerCase();
const text = (link.textContent || "").toLowerCase();
const isCheckout = CONFIG.CHECKOUT_KEYWORDS.some(function (kw) { return href.includes(kw) || text.includes(kw); });
if (isCheckout) {
send("ltv_checkout_intent", {
url: href.slice(0, 300),
text: link.textContent.trim().slice(0, 100),
score: scoreData.score,
});
addScore(15);
}
});// 32. ltv_checkout_abandon - detectado via visibilitychange apos checkout// 33. ltv_upsell_click
document.addEventListener("click", function (e) {
const link = e.target.closest("a[href*='upgrade'], a[href*='premium'], a[href*='pro']");
if (link) {
send("ltv_upsell_click", {
text: link.textContent.trim().slice(0, 100),
url: link.href.slice(0, 300),
});
}
});// 34. ltv_downsell_view
if (typeof IntersectionObserver !== "undefined") {
const downsells = document.querySelectorAll("[data-downsell], .oferta-especial, .special-offer");
const dsObs = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
sendOnce("ltv_downsell_view", "downsell", { element: entry.target.className.slice(0, 100) });
dsObs.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
downsells.forEach(function (d) { dsObs.observe(d); });
}// 35. ltv_recurring_signal
const pageVisits = JSON.parse(localStorage.getItem("ltv_page_visits") || "{}");
pageVisits[path] = (pageVisits[path] || 0) + 1;
localStorage.setItem("ltv_page_visits", JSON.stringify(pageVisits));
if (pageVisits[path] >= 2 && (path.includes("produto") || path.includes("mentoria") || path.includes("curso"))) {
send("ltv_recurring_signal", { page: path, visit_count: pageVisits[path] });
addScore(5);
}// 36. ltv_objection_signal - disparado no page_exit se tempo < 15s em pagina de preco// 37. ltv_social_proof_engage
if (typeof IntersectionObserver !== "undefined") {
const testimonials = document.querySelectorAll("[data-testimonial], .depoimento, .testimonial, .review");
testimonials.forEach(function (el) {
let timer = null;
const obs = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
timer = setTimeout(function () {
sendOnce("ltv_social_proof_engage", "proof_" + el.offsetTop, {
text: el.textContent.slice(0, 150),
seconds: 3,
});
addScore(3);
}, 3000);
} else {
if (timer) clearTimeout(timer);
}
});
}, { threshold: 0.5 });
obs.observe(el);
});
}// 38. ltv_guarantee_view
if (typeof IntersectionObserver !== "undefined") {
const guarantees = document.querySelectorAll("[data-guarantee], .garantia, .guarantee, .money-back");
const gObs = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
sendOnce("ltv_guarantee_view", "guarantee", {
text: entry.target.textContent.slice(0, 200),
});
gObs.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
guarantees.forEach(function (g) { gObs.observe(g); });
}// ============================================================
// BLOCO 5: MIDIA PROGRAMATICA (39-47)
// ============================================================// 39. ltv_ad_click
document.addEventListener("click", function (e) {
const ad = e.target.closest("ins.adsbygoogle, [data-ad], .ad-slot, iframe[src*='doubleclick'], iframe[src*='googlesyndication']");
if (ad) {
send("ltv_ad_click", { ad_src: (ad.dataset.adSlot || ad.className || "unknown").slice(0, 100) });
sessionData.ad_clicked = true;
sessionStorage.setItem("ltv_session", JSON.stringify(sessionData));
}
});// 40. ltv_ad_impression
if (typeof IntersectionObserver !== "undefined") {
const adSlots = document.querySelectorAll("ins.adsbygoogle, [data-ad], .ad-slot, [id^='div-gpt-ad']");
const adObs = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
sessionData.ads_seen++;
sessionStorage.setItem("ltv_session", JSON.stringify(sessionData));
const rect = entry.target.getBoundingClientRect();
const posLabel = rect.top < window.innerHeight ? "above_fold" : "below_fold";
send("ltv_ad_impression", {
ad_src: (entry.target.dataset.adSlot || entry.target.id || "unknown").slice(0, 100),
ad_position: Math.round(entry.target.offsetTop),
ad_position_label: posLabel,
ads_seen_session: sessionData.ads_seen,
});
adObs.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
adSlots.forEach(function (ad) { adObs.observe(ad); });
}// 41. ltv_ad_viewability_time
if (typeof IntersectionObserver !== "undefined") {
const adSlots2 = document.querySelectorAll("ins.adsbygoogle, [data-ad], .ad-slot, [id^='div-gpt-ad']");
adSlots2.forEach(function (ad) {
let viewTimer = null;
let viewStart = 0;
const obs = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
viewStart = Date.now();
viewTimer = setTimeout(function () {
send("ltv_ad_viewability_time", {
ad_id: (ad.id || ad.dataset.adSlot || "unknown").slice(0, 100),
seconds: 1,
position: Math.round(ad.offsetTop),
});
}, 1000);
} else {
if (viewTimer) clearTimeout(viewTimer);
}
});
}, { threshold: 0.5 });
obs.observe(ad);
});
}// 42. ltv_ad_slot_performance - disparado no page_exit// 43. ltv_ad_density_ratio
if (isPost()) {
setTimeout(function () {
const ads = document.querySelectorAll("ins.adsbygoogle, [data-ad], .ad-slot, [id^='div-gpt-ad']");
let adHeight = 0;
ads.forEach(function (ad) { adHeight += ad.offsetHeight; });
const contentHeight = (document.querySelector("article, main") || document.body).scrollHeight;
const ratio = contentHeight > 0 ? Math.round((adHeight / contentHeight) * 100) : 0;
send("ltv_ad_density_ratio", {
ads_count: ads.length,
content_height: contentHeight,
ad_height_total: adHeight,
ratio_pct: ratio,
verdict: ratio > 30 ? "high" : ratio > 15 ? "moderate" : "low",
});
}, 4000);
}// 44. ltv_ad_refresh_count
const adRefreshCounts = {};
setInterval(function () {
const ads = document.querySelectorAll("ins.adsbygoogle, [data-ad], [id^='div-gpt-ad']");
ads.forEach(function (ad) {
const id = ad.id || ad.dataset.adSlot || "ad_" + ad.offsetTop;
adRefreshCounts[id] = (adRefreshCounts[id] || 0) + 1;
if (adRefreshCounts[id] > 1 && adRefreshCounts[id] % 3 === 0) {
send("ltv_ad_refresh_count", { ad_id: id, refresh_number: adRefreshCounts[id] });
}
});
}, 10000);// 45. ltv_above_fold_time - disparado no page_exit// 46. ltv_sticky_ad_interact
document.addEventListener("click", function (e) {
const sticky = e.target.closest("[style*='position: fixed'], [style*='position:fixed'], [style*='position: sticky']");
if (sticky && (sticky.querySelector("ins.adsbygoogle, [data-ad]") || sticky.classList.contains("ad-slot"))) {
send("ltv_sticky_ad_interact", {
action: "click",
element: sticky.className.slice(0, 100),
});
}
});// 47. ltv_ad_blocked
setTimeout(function () {
const testAd = document.createElement("ins");
testAd.className = "adsbygoogle";
testAd.style.cssText = "display:block;width:1px;height:1px;position:absolute;left:-9999px";
document.body.appendChild(testAd);
setTimeout(function () {
const blocked = testAd.offsetHeight === 0 || getComputedStyle(testAd).display === "none";
sendOnce("ltv_ad_blocked", "ad_blocked", { blocked });
testAd.remove();
}, 500);
}, 3000);// ============================================================
// BLOCO 6: NAVEGACAO INTERNA (48-53)
// ============================================================// 48. ltv_cross_cluster
const prevCluster = sessionStorage.getItem("ltv_prev_cluster");
if (prevCluster && prevCluster !== cluster) {
send("ltv_cross_cluster", { from_cluster: prevCluster, to_cluster: cluster });
}
sessionStorage.setItem("ltv_prev_cluster", cluster);// 49. ltv_series_navigate
document.addEventListener("click", function (e) {
const link = e.target.closest("a");
if (!link) return;
const text = (link.textContent || "").toLowerCase();
if (text.includes("próximo") || text.includes("anterior") || text.includes("next") || text.includes("prev")) {
send("ltv_series_navigate", {
link_text: link.textContent.trim().slice(0, 100),
link_url: link.href.slice(0, 300),
});
}
});// 50. ltv_related_post_click
document.addEventListener("click", function (e) {
const link = e.target.closest(".related-posts a, .posts-relacionados a, [data-related] a");
if (link) {
send("ltv_related_post_click", {
url: link.href.slice(0, 300),
text: link.textContent.trim().slice(0, 100),
});
}
});// 51. ltv_internal_search
document.addEventListener("submit", function (e) {
const form = e.target;
const searchInput = form.querySelector("input[type='search'], input[name='s'], input[name='q']");
if (searchInput) {
send("ltv_internal_search", { query: searchInput.value.slice(0, 200), source: cluster });
}
});// 52. ltv_404_hit
if (document.title.toLowerCase().includes("404") || document.querySelector(".error-404, .not-found")) {
send("ltv_404_hit", { url: location.href, referrer: document.referrer.slice(0, 300) });
}// 53. ltv_back_button
window.addEventListener("popstate", function () {
send("ltv_back_button", { page: location.pathname, type: "history" });
});// ============================================================
// BLOCO 7: ENGAJAMENTO SOCIAL/EXTERNO (54-59)
// ============================================================// 54. ltv_social_click + 55. ltv_outbound_click
document.addEventListener("click", function (e) {
const link = e.target.closest("a[href^='http']");
if (!link || link.hostname === location.hostname) return;
const href = link.href.toLowerCase();
const isSocial = CONFIG.SOCIAL_DOMAINS.some(function (d) { return href.includes(d); });
if (isSocial) {
const platform = CONFIG.SOCIAL_DOMAINS.find(function (d) { return href.includes(d); }).split(".")[0];
send("ltv_social_click", {
platform,
url: link.href.slice(0, 300),
text: link.textContent.trim().slice(0, 100),
});
} else {
send("ltv_outbound_click", {
dest_host: link.hostname,
url: link.href.slice(0, 300),
text: link.textContent.trim().slice(0, 100),
});
}
});// 56. ltv_share_intent
document.addEventListener("click", function (e) {
const btn = e.target.closest("[data-share], .share-button, .compartilhar, a[href*='share']");
if (btn) {
send("ltv_share_intent", {
text: btn.textContent.trim().slice(0, 100),
title: document.title,
});
}
});// 57. ltv_copy_text
let copyCount = 0;
document.addEventListener("copy", function () {
const selected = window.getSelection().toString();
if (selected.length > 5) {
copyCount++;
send("ltv_copy_text", {
text: selected.slice(0, 200),
count: copyCount,
cluster,
});
}
});// 58. ltv_text_select
document.addEventListener("mouseup", function () {
const sel = window.getSelection().toString();
if (sel.length >= 10 && sel.length <= 500) {
send("ltv_text_select", { text: sel.slice(0, 200), length: sel.length });
}
});// 59. ltv_comment_engage
if (typeof IntersectionObserver !== "undefined") {
const comments = document.querySelectorAll("#comments, .comments-area, .comentarios, #disqus_thread");
const cObs = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
sendOnce("ltv_comment_engage", "comment_engage", { action: "viewed" });
cObs.unobserve(entry.target);
}
});
}, { threshold: 0.3 });
comments.forEach(function (c) { cObs.observe(c); });
}// ============================================================
// BLOCO 8: FRUSTRACAO/UX (60-66)
// ============================================================// 60. ltv_rage_click
let clicks = [];
document.addEventListener("click", function (e) {
const now = Date.now();
clicks.push({ x: e.clientX, y: e.clientY, t: now, el: e.target.tagName });
clicks = clicks.filter(function (c) { return now - c.t < 1500; });
if (clicks.length >= 3) {
const area = clicks.every(function (c) {
return Math.abs(c.x - clicks[0].x) < 50 && Math.abs(c.y - clicks[0].y) < 50;
});
if (area) {
sendOnce("ltv_rage_click", "rage_" + Math.round(now / 5000), {
x: e.clientX, y: e.clientY,
element: e.target.tagName + "." + (e.target.className || "").toString().slice(0, 50),
count: clicks.length,
});
clicks = [];
}
}
});// 61. ltv_dead_click
document.addEventListener("click", function (e) {
if (Math.random() > 0.1) return; // 10% sample
const tag = e.target.tagName;
if (!["A", "BUTTON", "INPUT", "SELECT", "TEXTAREA", "LABEL"].includes(tag) && !e.target.closest("a, button")) {
send("ltv_dead_click", {
element: tag + "." + (e.target.className || "").toString().slice(0, 50),
text: (e.target.textContent || "").slice(0, 100),
x: e.clientX, y: e.clientY,
});
}
});// 62. ltv_rage_scroll
let rageScrollSpeeds = [];
let rageLastY = 0;
let rageLastT = Date.now();
window.addEventListener("scroll", function () {
const now = Date.now();
const dt = now - rageLastT;
if (dt > 100 && dt < 500) {
const speed = Math.abs(window.scrollY - rageLastY) / (dt / 1000);
if (speed > 5000) rageScrollSpeeds.push(speed);
if (rageScrollSpeeds.length >= 3) {
sendOnce("ltv_rage_scroll", "rage_scroll", {
speed: Math.round(speed),
scroll_pct: getScrollPct(),
});
rageScrollSpeeds = [];
}
}
rageLastY = window.scrollY;
rageLastT = now;
});// 63. ltv_idle
["mousemove", "keydown", "scroll", "touchstart", "click"].forEach(function (evt) {
document.addEventListener(evt, function () {
lastActivity = Date.now();
idleFired = false;
});
});
setInterval(function () {
if (!idleFired && Date.now() - lastActivity > CONFIG.IDLE_TIMEOUT) {
idleFired = true;
send("ltv_idle", {
idle_seconds: Math.round((Date.now() - lastActivity) / 1000),
scroll_pct: getScrollPct(),
time_on_page: Math.round((Date.now() - pageStart) / 1000),
});
}
}, 5000);// 64. ltv_print_page
window.addEventListener("beforeprint", function () {
send("ltv_print_page", { title: document.title, cluster });
});
document.addEventListener("keydown", function (e) {
if ((e.ctrlKey || e.metaKey) && e.key === "p") {
sendOnce("ltv_print_page", "print", { title: document.title, cluster });
}
});// 65. ltv_bookmark
document.addEventListener("keydown", function (e) {
if ((e.ctrlKey || e.metaKey) && e.key === "d") {
sendOnce("ltv_bookmark", "bookmark", { title: document.title, cluster });
}
});// 66. ltv_pinch_zoom
let lastTouchDist = 0;
document.addEventListener("touchmove", function (e) {
if (e.touches.length === 2) {
const dx = e.touches[0].clientX - e.touches[1].clientX;
const dy = e.touches[0].clientY - e.touches[1].clientY;
const dist = Math.sqrt(dx * dx + dy * dy);
if (lastTouchDist > 0 && Math.abs(dist - lastTouchDist) > 50) {
sendOnce("ltv_pinch_zoom", "pinch", { page: location.pathname });
}
lastTouchDist = dist;
}
}, { passive: true });// ============================================================
// BLOCO 9: CONTEXTO TECNICO/DISPOSITIVO (67-73)
// ============================================================// 67. ltv_device_profile
if (scoreData.total_sessions <= 1) {
send("ltv_device_profile", {
screen: screen.width + "x" + screen.height,
viewport: window.innerWidth + "x" + window.innerHeight,
pixel_ratio: window.devicePixelRatio,
touch: "ontouchstart" in window,
memory: navigator.deviceMemory || "unknown",
cores: navigator.hardwareConcurrency || "unknown",
language: navigator.language,
});
}// 68. ltv_slow_connection
if (navigator.connection) {
const conn = navigator.connection;
const isSlow = conn.effectiveType === "2g" || conn.effectiveType === "slow-2g" || conn.downlink < 1;
sendOnce("ltv_slow_connection", "slow_conn", {
type: conn.effectiveType,
downlink: conn.downlink,
rtt: conn.rtt,
save_data: conn.saveData,
is_slow: isSlow,
});
}// 69. ltv_dark_mode
sendOnce("ltv_dark_mode", "dark_mode", {
prefers_dark: window.matchMedia("(prefers-color-scheme: dark)").matches,
});// 70. ltv_tab_switch
let tabSwitchCount = 0;
let tabAwayStart = 0;
document.addEventListener("visibilitychange", function () {
if (document.hidden) {
tabAwayStart = Date.now();
} else {
tabSwitchCount++;
send("ltv_tab_switch", {
switch_count: tabSwitchCount,
away_seconds: tabAwayStart ? Math.round((Date.now() - tabAwayStart) / 1000) : 0,
came_back: true,
});
}
});// 71. ltv_orientation_change
window.addEventListener("orientationchange", function () {
send("ltv_orientation_change", {
orientation: screen.orientation ? screen.orientation.type : (window.innerHeight > window.innerWidth ? "portrait" : "landscape"),
});
});// 72. ltv_page_load_time
setTimeout(function () {
if (performance && performance.timing) {
const t = performance.timing;
sendOnce("ltv_page_load_time", "page_load", {
load_ms: t.loadEventEnd - t.navigationStart,
ttfb_ms: t.responseStart - t.navigationStart,
dom_ready_ms: t.domContentLoadedEventEnd - t.navigationStart,
verdict: (t.loadEventEnd - t.navigationStart) > 3000 ? "slow" : "fast",
});
}
}, 3000);// 73. ltv_search_query_landing
if (document.referrer) {
try {
const ref = new URL(document.referrer);
const q = ref.searchParams.get("q") || ref.searchParams.get("query") || ref.searchParams.get("p");
if (q) {
sendOnce("ltv_search_query_landing", "search_landing", {
query: q.slice(0, 200),
engine: ref.hostname,
});
}
} catch (e) {}
}// ============================================================
// BLOCO 10: RETARGETING/AUDIENCIA (74-83)
// ============================================================// 74. ltv_push_response
if ("Notification" in window) {
sendOnce("ltv_push_response", "push_response", { response: Notification.permission });
}// 75. ltv_segment_auto
const topClusters = Object.entries(scoreData.clusters).sort(function (a, b) { return b[1] - a[1]; });
send("ltv_segment_auto", {
persona: getSegment(),
segment: getLifecycleStage(),
top_cluster: topClusters[0] ? topClusters[0][0] : "none",
score: scoreData.score,
total_pages: scoreData.total_pages,
});// 76. ltv_frequency_cap
const sessionsThisWeek = scoreData.days_active.filter(function (d) {
const diff = (new Date() - new Date(d)) / 86400000;
return diff <= 7;
}).length;
if (sessionsThisWeek > 1) {
send("ltv_frequency_cap", { sessions_this_week: sessionsThisWeek });
}// 77. ltv_content_preference
if (topClusters.length >= 1) {
send("ltv_content_preference", {
top1: topClusters[0] ? topClusters[0][0] : "",
top2: topClusters[1] ? topClusters[1][0] : "",
top3: topClusters[2] ? topClusters[2][0] : "",
counts: JSON.stringify(Object.fromEntries(topClusters.slice(0, 3))),
});
}// 78. ltv_lifecycle_stage
send("ltv_lifecycle_stage", {
stage: getLifecycleStage(),
first_visit: scoreData.first_visit,
days_active: scoreData.days_active.length,
score: scoreData.score,
});// 79. ltv_cohort_tag
if (scoreData.total_sessions <= 1) {
const now = new Date();
send("ltv_cohort_tag", {
cohort_week: now.getFullYear() + "-W" + Math.ceil((now.getDate() + new Date(now.getFullYear(), now.getMonth(), 1).getDay()) / 7),
cohort_month: now.getFullYear() + "-" + String(now.getMonth() + 1).padStart(2, "0"),
});
}// 80. ltv_return_visitor
if (scoreData.total_sessions > 1) {
const sorted = scoreData.days_active.sort();
const lastDay = sorted[sorted.length - 2] || sorted[0];
const daysSince = Math.round((new Date() - new Date(lastDay)) / 86400000);
send("ltv_return_visitor", {
days_since: daysSince,
total_days: scoreData.days_active.length,
score: scoreData.score,
});
}// 81. ltv_multi_session
if (scoreData.total_sessions >= 3) {
sendOnce("ltv_multi_session", "multi_session", { total_sessions: scoreData.total_sessions });
addScore(5);
}// 82. ltv_retarget_pixel
send("ltv_retarget_pixel", {
ltv_tier: getSegment(),
ltv_score: scoreData.score,
});// 83. ltv_audience_value - disparado no page_exit// ============================================================
// BLOCO 11: ROI/ATRIBUICAO (84-90)
// ============================================================// 84. ltv_conversion_path
const navPath = JSON.parse(sessionStorage.getItem("ltv_nav_path") || "[]");
navPath.push(location.pathname);
sessionStorage.setItem("ltv_nav_path", JSON.stringify(navPath));
// disparado no cta_click// 85. ltv_assisted_content - disparado no cta_click se page_count >= 2// 86-90: disparados no page_exit// ============================================================
// BLOCO 12: MICRO-SINAIS AVANCADOS (91-94)
// ============================================================// 91. ltv_mouse_pattern
let mouseChecks = 0;
let mouseActive = 0;
let mouseIdle = 0;
let mouseMoving = false;
let mouseTimer = null;
document.addEventListener("mousemove", function () {
mouseMoving = true;
if (mouseTimer) clearTimeout(mouseTimer);
mouseTimer = setTimeout(function () { mouseMoving = false; }, 5000);
});
setInterval(function () {
mouseChecks++;
if (mouseMoving) mouseActive++;
else mouseIdle++;
if (mouseChecks >= 12 && mouseChecks % 12 === 0) {
send("ltv_mouse_pattern", {
active_pct: Math.round((mouseActive / mouseChecks) * 100),
idle_intervals: mouseIdle,
total_checks: mouseChecks,
});
}
}, 5000);// 92. ltv_video_play
document.addEventListener("play", function (e) {
if (e.target.tagName === "VIDEO" || e.target.tagName === "AUDIO") {
send("ltv_video_play", {
source: e.target.currentSrc ? e.target.currentSrc.slice(0, 200) : "native",
page: location.pathname,
duration: Math.round(e.target.duration || 0),
});
}
}, true);
// YouTube iframes
window.addEventListener("message", function (e) {
try {
const data = JSON.parse(e.data);
if (data.event === "onStateChange" && data.info === 1) {
sendOnce("ltv_video_play", "yt_play", { source: "youtube", page: location.pathname });
}
} catch (err) {}
});// 93. ltv_highlight_extension
setTimeout(function () {
const highlights = document.querySelectorAll("mark, .hypothesis-highlight, [data-hypothesis-trigger], web-highlighter-highlight");
if (highlights.length > 0) {
send("ltv_highlight_extension", { count: highlights.length });
}
}, 5000);// ============================================================
// BLOCO 13: PAGE EXIT + EXTRAS MONETIZACAO (94-105)
// ============================================================// Evento master de saida: dispara varios eventos de uma vez
document.addEventListener("visibilitychange", function () {
if (!document.hidden) return;const timeOnPage = Math.round((Date.now() - pageStart) / 1000);
const words = getWordCount();
const wpm = timeOnPage > 0 ? Math.round((words * (maxScroll / 100)) / (timeOnPage / 60)) : 0;// 94. ltv_page_exit
send("ltv_page_exit", {
time_on_page: timeOnPage,
max_scroll: maxScroll,
pages_session: sessionData.page_count,
cluster, score: scoreData.score,
ads_seen: sessionData.ads_seen,
ad_clicked: sessionData.ad_clicked,
source, medium,
});// 14. ltv_word_count_vs_time (deferred)
if (words > 50) {
send("ltv_word_count_vs_time", {
words, seconds: timeOnPage, wpm, scroll_pct: maxScroll,
verdict: wpm > 400 ? "skimmer" : wpm > 200 ? "normal" : "deep",
});
}// 36. ltv_objection_signal
if (timeOnPage < 15 && (path.includes("pricing") || path.includes("preco") || path.includes("plano"))) {
send("ltv_objection_signal", { time_on_page: timeOnPage, scroll_pct: maxScroll, score: scoreData.score });
}// 42. ltv_ad_slot_performance
send("ltv_ad_slot_performance", {
total_impressions: sessionData.ads_seen,
time_on_page: timeOnPage,
scroll_max: maxScroll,
cluster,
ad_clicked: sessionData.ad_clicked,
});// 45. ltv_above_fold_time
send("ltv_above_fold_time", { seconds: timeOnPage });// 83. ltv_audience_value
const convProb = Math.min(1, scoreData.score / 100);
send("ltv_audience_value", {
estimated_ltv_brl: Math.round(scoreData.score * 0.5 * scoreData.days_active.length),
ad_value_session: sessionData.ads_seen * 0.02,
conversion_probability: Math.round(convProb * 100) / 100,
engagement_multiplier: Math.round(timeOnPage / 60 * 10) / 10,
sessions: scoreData.total_sessions,
days: scoreData.days_active.length,
score: scoreData.score,
});// 86. ltv_revenue_attributed
send("ltv_revenue_attributed", {
ad_revenue_est: Math.round(sessionData.ads_seen * 0.02 * 100) / 100,
ads_impressions: sessionData.ads_seen,
ad_clicked: sessionData.ad_clicked,
time_on_page: timeOnPage,
cluster, source, medium,
});// 87. ltv_content_roi (posts only)
if (isPost()) {
send("ltv_content_roi", {
post: path, title: document.title, cluster,
ad_impressions: sessionData.ads_seen,
ad_clicked: sessionData.ad_clicked,
time_spent: timeOnPage, scroll_max: maxScroll,
cta_clicked: sessionData.cta_clicked,
});
}// 88. ltv_cluster_roi
send("ltv_cluster_roi", {
cluster,
total_views: scoreData.clusters[cluster] || 1,
total_time: timeOnPage,
total_ads: sessionData.ads_seen,
total_ctas: sessionData.cta_clicked ? 1 : 0,
});// 89. ltv_source_roi
send("ltv_source_roi", {
source, medium,
total_views: sessionData.page_count,
total_time: timeOnPage,
total_ctas: sessionData.cta_clicked ? 1 : 0,
});// 90. ltv_lifetime_value
send("ltv_lifetime_value", {
total_sessions: scoreData.total_sessions,
total_days: scoreData.days_active.length,
total_ad_impressions: sessionData.ads_seen,
score: scoreData.score,
stage: getLifecycleStage(),
first_visit: scoreData.first_visit,
});// 95. ltv_exit_page
const prevPage = sessionStorage.getItem("ltv_prev_page") || "";
if (prevPage) {
send("ltv_exit_page", { exit_from: prevPage, now_on: path });
}
sessionStorage.setItem("ltv_prev_page", path);// 96. ltv_scroll_to_end
if (isPost() && maxScroll >= 95) {
send("ltv_scroll_to_end", { title: document.title, time_to_end: timeOnPage, cluster });
}// 97. ltv_engagement_quality
const qualityScore = Math.min(100, Math.round(
(Math.min(timeOnPage, 300) / 300) * 30 +
(maxScroll / 100) * 30 +
(Math.min(sessionData.page_count, 10) / 10) * 40
));
send("ltv_engagement_quality", {
quality_score: qualityScore,
time: timeOnPage, scroll: maxScroll,
pages: sessionData.page_count,
verdict: qualityScore > 70 ? "excellent" : qualityScore > 40 ? "good" : qualityScore > 20 ? "average" : "low",
});// 98. ltv_session_value
send("ltv_session_value", {
pages: sessionData.page_count,
time: timeOnPage,
ads: sessionData.ads_seen,
ctas: sessionData.cta_clicked ? 1 : 0,
score_gained: scoreData.score,
source, medium,
});// 84. ltv_conversion_path (on CTA)
if (sessionData.cta_clicked) {
send("ltv_conversion_path", {
path: JSON.stringify(navPath.slice(-5)),
steps: navPath.length,
cta: path,
});
}// 85. ltv_assisted_content
if (sessionData.cta_clicked && navPath.length >= 2) {
send("ltv_assisted_content", {
converting_page: path,
assist_page: navPath[navPath.length - 2] || "",
total_assists: navPath.length - 1,
});
}
});// 99. ltv_new_vs_returning
sendOnce("ltv_new_vs_returning", "new_vs_ret", {
type: scoreData.total_sessions <= 1 ? "new" : "returning",
});// 100. ltv_campaign_track
if (getUTM("utm_source")) {
sendOnce("ltv_campaign_track", "campaign_" + getUTM("utm_campaign"), {
source: getUTM("utm_source"),
medium: getUTM("utm_medium"),
campaign: getUTM("utm_campaign"),
term: getUTM("utm_term"),
content: getUTM("utm_content"),
});
}// 101. ltv_landing_page
if (sessionData.page_count === 1) {
send("ltv_landing_page", {
page: path,
cluster,
source, medium,
score_at_entry: scoreData.score,
});
}// 102. ltv_recency
if (scoreData.total_sessions > 1) {
const sorted = scoreData.days_active.sort();
const lastDay = sorted[sorted.length - 2] || sorted[0];
const daysSince = Math.round((new Date() - new Date(lastDay)) / 86400000);
const bucket = daysSince <= 1 ? "1d" : daysSince <= 3 ? "3d" : daysSince <= 7 ? "7d" : daysSince <= 14 ? "14d" : "30d+";
sendOnce("ltv_recency", "recency", { days_since_last: daysSince, bucket });
}// 103. ltv_scroll_velocity
let scrollSamples = [];
let velLastY = 0;
let velLastT = Date.now();
window.addEventListener("scroll", function () {
const now = Date.now();
const dt = now - velLastT;
if (dt > 2000) {
const speed = Math.abs(window.scrollY - velLastY) / (dt / 1000);
scrollSamples.push(speed);
velLastY = window.scrollY;
velLastT = now;
if (scrollSamples.length === 20) {
const avg = scrollSamples.reduce(function (a, b) { return a + b; }, 0) / 20;
sendOnce("ltv_scroll_velocity", "scroll_vel", {
avg_px_per_sec: Math.round(avg),
verdict: avg > 1000 ? "fast" : avg > 300 ? "normal" : "slow",
});
}
}
});// 104. ltv_goal_complete
function checkGoals() {
const goals = [
{ name: "reader", scoreMin: 10, condition: function () { return maxScroll >= 50; } },
{ name: "engaged", scoreMin: 30, condition: function () { return (Date.now() - pageStart) > 120000; } },
{ name: "hot_lead", scoreMin: 50, condition: function () { return true; } },
{ name: "converter", scoreMin: 70, condition: function () { return sessionData.cta_clicked; } },
];
goals.forEach(function (goal) {
if (scoreData.score >= goal.scoreMin && goal.condition()) {
sendOnce("ltv_goal_complete", "goal_" + goal.name, {
goal: goal.name,
time: Math.round((Date.now() - pageStart) / 1000),
score: scoreData.score,
pages: sessionData.page_count,
});
}
});
}
setInterval(checkGoals, 10000);
checkGoals();// 105. ltv_LTV_Segment (Meta Pixel)
if (typeof fbq === "function") {
fbq("trackCustom", "LTV_Segment", {
segment: getSegment(),
score: scoreData.score,
stage: getLifecycleStage(),
});
}})();