[{"data":1,"prerenderedAt":2852},["ShallowReactive",2],{"article-alternates":3,"article-\u002Fes\u002Fdata\u002Fanalitika-centrada-en-privacidad-plausible-agregacion-servidor":13},{"i18nKey":4,"paths":5},"data-006-2026-07",{"de":6,"en":7,"es":8,"fr":9,"it":10,"ru":11,"tr":12},"\u002Fde\u002Fdata\u002Fprivacy-first-analytics-plausible-server-side","\u002Fen\u002Fdata\u002Fprivacy-first-analytics-plausible-server-side-aggregation","\u002Fes\u002Fdata\u002Fprivacidad-first-analytics-plausible-agregacion-servidor","\u002Ffr\u002Fdata\u002Fprivacy-first-analytics-plausible-server-side-aggregation","\u002Fit\u002Fdata\u002Fanalytics-privacy-first-plausible-aggregazione-lato-server","\u002Fru\u002Fdata\u002Fprivacy-first-analytics-plausible-serverside-aggregation","\u002Ftr\u002Fdata\u002Fprivacy-first-analytics-plausible-ve-sunucu-tarafi-aggregation",{"_path":14,"_dir":15,"_draft":16,"_partial":16,"_locale":17,"title":18,"description":19,"publishedAt":20,"modifiedAt":20,"category":15,"i18nKey":4,"tags":21,"readingTime":27,"author":28,"body":29,"_type":2846,"_id":2847,"_source":2848,"_file":2849,"_stem":2850,"_extension":2851},"\u002Fes\u002Fdata\u002Fanalitika-centrada-en-privacidad-plausible-agregacion-servidor","data",false,"","Analítica Centrada en Privacidad: Plausible y Aggregation en Servidor","Tracking sin cookies, cumplimiento RGPD\u002FKVKK y alternativa a GA4: arquitectura Plausible + aggregation servidor para re-instrumentar medición de usuarios.","2026-07-26",[22,23,24,25,26],"privacy-first-analytics","plausible","cookieless-tracking","cumplimiento-rgpd","server-side-aggregation",9,"Roibase",{"type":30,"children":31,"toc":2837},"root",[32,40,47,52,57,62,68,73,82,592,613,623,867,872,878,889,902,948,960,1436,1469,1724,1729,1735,1740,1765,1770,1793,1798,1821,1826,1844,1852,1875,1880,1886,1898,1911,2162,2178,2184,2204,2209,2352,2357,2425,2438,2443,2449,2454,2831],{"type":33,"tag":34,"props":35,"children":36},"element","p",{},[37],{"type":38,"value":39},"text","El límite de retención de ID de usuario de \"360 días\" que GA4 comunicó a mediados de 2024, junto con el Consent Mode v2 que se hizo obligatorio en marzo de 2024, dejó a los equipos de marketing con dos opciones: perder la tasa de aceptación del banner de cookies al 40% y desmantelar la arquitectura de segmentación heredada desde UA, o construir un nuevo stack de medición que funcione sin cookies. La combinación de herramientas de analítica centrada en privacidad como Plausible con arquitectura de aggregation en servidor se convirtió en la solución técnica de este escenario.",{"type":33,"tag":41,"props":42,"children":44},"h2",{"id":43},"bloqueo-de-cookies-supera-el-60",[45],{"type":38,"value":46},"Bloqueo de Cookies Supera el 60%",{"type":33,"tag":34,"props":48,"children":49},{},[50],{"type":38,"value":51},"Apple bloquea cookies de terceros en Safari desde Intelligent Tracking Prevention (ITP) en 2017; Chrome activó Privacy Sandbox por defecto en el último trimestre de 2024; Firefox tiene Tracking Protection habilitado por defecto. Según el informe 2025 de Mozilla, el promedio de usuarios europeos hace clic en \"Rechazar\" o cierra el banner de cookies en un 62%. En propiedades de GA4, el número de sessions marcadas como consent_status=denied está entre el 55-65% en sitios B2C desde Q4 2024.",{"type":33,"tag":34,"props":53,"children":54},{},[55],{"type":38,"value":56},"Esto significa que los píxeles clásicos lado cliente (gtag.js, fbq) pierden más de la mitad del tráfico. La función \"modeled conversion\" de GA4 intenta llenar este vacío pero usar datos modelados significa construir segmentos de audiencia mediante regresiones en lugar de eventos reales. En pruebas de incrementalidad, los conjuntos de conversion modelados muestran una desviación promedio de 18-22% comparados con conversiones reales (documentación beta Google Marketing Platform 2025).",{"type":33,"tag":34,"props":58,"children":59},{},[60],{"type":38,"value":61},"El tracking sin cookies se basa en dos arquitecturas: una recopila eventos completamente en servidor (GTM del lado del servidor, Segment, RudderStack); la otra crea identificadores de sesión temporales en cliente mediante sessionStorage\u002FlocalStorage y los envía al servidor. Plausible Analytics utiliza el segundo enfoque pero el identificador no es persistente — cada sesión genera un hash nuevo. A primera vista parece imposible rastrear \"viajes del usuario\"; en realidad, la agregación en servidor habilita análisis de cohortes y medición de retención.",{"type":33,"tag":41,"props":63,"children":65},{"id":64},"arquitectura-plausible-beacon-post-y-event-stream",[66],{"type":38,"value":67},"Arquitectura Plausible: Beacon POST y Event Stream",{"type":33,"tag":34,"props":69,"children":70},{},[71],{"type":38,"value":72},"Plausible es una plataforma de analítica web de código abierto con licencia MIT (plausible.io). El tamaño del script es 1.4 KB (GA4 tiene 43 KB, Segment 28 KB); no escribe cookies; cumple RGPD\u002FKVKK\u002FCCPA por defecto. ¿Cómo funciona?",{"type":33,"tag":34,"props":74,"children":75},{},[76],{"type":33,"tag":77,"props":78,"children":79},"strong",{},[80],{"type":38,"value":81},"Script del cliente:",{"type":33,"tag":83,"props":84,"children":88},"pre",{"className":85,"code":86,"language":87,"meta":17,"style":17},"language-javascript shiki shiki-themes github-dark","\u002F\u002F implementación mínima plausible.js\n(function(){\n  const endpoint = 'https:\u002F\u002Fanalytics.example.com\u002Fapi\u002Fevent';\n  const sessionHash = btoa(navigator.userAgent + performance.timing.navigationStart).substring(0,16);\n  \n  function sendEvent(name, props = {}) {\n    navigator.sendBeacon(endpoint, JSON.stringify({\n      n: name,              \u002F\u002F nombre del evento\n      u: location.href,     \u002F\u002F URL de la página\n      d: document.domain,\n      r: document.referrer,\n      w: window.innerWidth,\n      h: sessionHash,       \u002F\u002F identificador de sesión temporal\n      p: props              \u002F\u002F propiedades personalizadas\n    }));\n  }\n  \n  sendEvent('pageview');\n  \n  \u002F\u002F rastreo de clics\n  document.addEventListener('click', (e) => {\n    if (e.target.matches('[data-track]')) {\n      sendEvent('click', { element: e.target.dataset.track });\n    }\n  });\n})();\n","javascript",[89],{"type":33,"tag":90,"props":91,"children":92},"code",{"__ignoreMap":17},[93,105,126,157,224,233,276,315,329,342,351,360,369,383,397,406,415,423,445,453,462,510,543,565,574,583],{"type":33,"tag":94,"props":95,"children":98},"span",{"class":96,"line":97},"line",1,[99],{"type":33,"tag":94,"props":100,"children":102},{"style":101},"--shiki-default:#6A737D",[103],{"type":38,"value":104},"\u002F\u002F implementación mínima plausible.js\n",{"type":33,"tag":94,"props":106,"children":108},{"class":96,"line":107},2,[109,115,121],{"type":33,"tag":94,"props":110,"children":112},{"style":111},"--shiki-default:#E1E4E8",[113],{"type":38,"value":114},"(",{"type":33,"tag":94,"props":116,"children":118},{"style":117},"--shiki-default:#F97583",[119],{"type":38,"value":120},"function",{"type":33,"tag":94,"props":122,"children":123},{"style":111},[124],{"type":38,"value":125},"(){\n",{"type":33,"tag":94,"props":127,"children":129},{"class":96,"line":128},3,[130,135,141,146,152],{"type":33,"tag":94,"props":131,"children":132},{"style":117},[133],{"type":38,"value":134},"  const",{"type":33,"tag":94,"props":136,"children":138},{"style":137},"--shiki-default:#79B8FF",[139],{"type":38,"value":140}," endpoint",{"type":33,"tag":94,"props":142,"children":143},{"style":117},[144],{"type":38,"value":145}," =",{"type":33,"tag":94,"props":147,"children":149},{"style":148},"--shiki-default:#9ECBFF",[150],{"type":38,"value":151}," 'https:\u002F\u002Fanalytics.example.com\u002Fapi\u002Fevent'",{"type":33,"tag":94,"props":153,"children":154},{"style":111},[155],{"type":38,"value":156},";\n",{"type":33,"tag":94,"props":158,"children":160},{"class":96,"line":159},4,[161,165,170,174,180,185,190,195,200,204,209,214,219],{"type":33,"tag":94,"props":162,"children":163},{"style":117},[164],{"type":38,"value":134},{"type":33,"tag":94,"props":166,"children":167},{"style":137},[168],{"type":38,"value":169}," sessionHash",{"type":33,"tag":94,"props":171,"children":172},{"style":117},[173],{"type":38,"value":145},{"type":33,"tag":94,"props":175,"children":177},{"style":176},"--shiki-default:#B392F0",[178],{"type":38,"value":179}," btoa",{"type":33,"tag":94,"props":181,"children":182},{"style":111},[183],{"type":38,"value":184},"(navigator.userAgent ",{"type":33,"tag":94,"props":186,"children":187},{"style":117},[188],{"type":38,"value":189},"+",{"type":33,"tag":94,"props":191,"children":192},{"style":111},[193],{"type":38,"value":194}," performance.timing.navigationStart).",{"type":33,"tag":94,"props":196,"children":197},{"style":176},[198],{"type":38,"value":199},"substring",{"type":33,"tag":94,"props":201,"children":202},{"style":111},[203],{"type":38,"value":114},{"type":33,"tag":94,"props":205,"children":206},{"style":137},[207],{"type":38,"value":208},"0",{"type":33,"tag":94,"props":210,"children":211},{"style":111},[212],{"type":38,"value":213},",",{"type":33,"tag":94,"props":215,"children":216},{"style":137},[217],{"type":38,"value":218},"16",{"type":33,"tag":94,"props":220,"children":221},{"style":111},[222],{"type":38,"value":223},");\n",{"type":33,"tag":94,"props":225,"children":227},{"class":96,"line":226},5,[228],{"type":33,"tag":94,"props":229,"children":230},{"style":111},[231],{"type":38,"value":232},"  \n",{"type":33,"tag":94,"props":234,"children":236},{"class":96,"line":235},6,[237,242,247,251,257,262,267,271],{"type":33,"tag":94,"props":238,"children":239},{"style":117},[240],{"type":38,"value":241},"  function",{"type":33,"tag":94,"props":243,"children":244},{"style":176},[245],{"type":38,"value":246}," sendEvent",{"type":33,"tag":94,"props":248,"children":249},{"style":111},[250],{"type":38,"value":114},{"type":33,"tag":94,"props":252,"children":254},{"style":253},"--shiki-default:#FFAB70",[255],{"type":38,"value":256},"name",{"type":33,"tag":94,"props":258,"children":259},{"style":111},[260],{"type":38,"value":261},", ",{"type":33,"tag":94,"props":263,"children":264},{"style":253},[265],{"type":38,"value":266},"props",{"type":33,"tag":94,"props":268,"children":269},{"style":117},[270],{"type":38,"value":145},{"type":33,"tag":94,"props":272,"children":273},{"style":111},[274],{"type":38,"value":275}," {}) {\n",{"type":33,"tag":94,"props":277,"children":279},{"class":96,"line":278},7,[280,285,290,295,300,305,310],{"type":33,"tag":94,"props":281,"children":282},{"style":111},[283],{"type":38,"value":284},"    navigator.",{"type":33,"tag":94,"props":286,"children":287},{"style":176},[288],{"type":38,"value":289},"sendBeacon",{"type":33,"tag":94,"props":291,"children":292},{"style":111},[293],{"type":38,"value":294},"(endpoint, ",{"type":33,"tag":94,"props":296,"children":297},{"style":137},[298],{"type":38,"value":299},"JSON",{"type":33,"tag":94,"props":301,"children":302},{"style":111},[303],{"type":38,"value":304},".",{"type":33,"tag":94,"props":306,"children":307},{"style":176},[308],{"type":38,"value":309},"stringify",{"type":33,"tag":94,"props":311,"children":312},{"style":111},[313],{"type":38,"value":314},"({\n",{"type":33,"tag":94,"props":316,"children":318},{"class":96,"line":317},8,[319,324],{"type":33,"tag":94,"props":320,"children":321},{"style":111},[322],{"type":38,"value":323},"      n: name,              ",{"type":33,"tag":94,"props":325,"children":326},{"style":101},[327],{"type":38,"value":328},"\u002F\u002F nombre del evento\n",{"type":33,"tag":94,"props":330,"children":331},{"class":96,"line":27},[332,337],{"type":33,"tag":94,"props":333,"children":334},{"style":111},[335],{"type":38,"value":336},"      u: location.href,     ",{"type":33,"tag":94,"props":338,"children":339},{"style":101},[340],{"type":38,"value":341},"\u002F\u002F URL de la página\n",{"type":33,"tag":94,"props":343,"children":345},{"class":96,"line":344},10,[346],{"type":33,"tag":94,"props":347,"children":348},{"style":111},[349],{"type":38,"value":350},"      d: document.domain,\n",{"type":33,"tag":94,"props":352,"children":354},{"class":96,"line":353},11,[355],{"type":33,"tag":94,"props":356,"children":357},{"style":111},[358],{"type":38,"value":359},"      r: document.referrer,\n",{"type":33,"tag":94,"props":361,"children":363},{"class":96,"line":362},12,[364],{"type":33,"tag":94,"props":365,"children":366},{"style":111},[367],{"type":38,"value":368},"      w: window.innerWidth,\n",{"type":33,"tag":94,"props":370,"children":372},{"class":96,"line":371},13,[373,378],{"type":33,"tag":94,"props":374,"children":375},{"style":111},[376],{"type":38,"value":377},"      h: sessionHash,       ",{"type":33,"tag":94,"props":379,"children":380},{"style":101},[381],{"type":38,"value":382},"\u002F\u002F identificador de sesión temporal\n",{"type":33,"tag":94,"props":384,"children":386},{"class":96,"line":385},14,[387,392],{"type":33,"tag":94,"props":388,"children":389},{"style":111},[390],{"type":38,"value":391},"      p: props              ",{"type":33,"tag":94,"props":393,"children":394},{"style":101},[395],{"type":38,"value":396},"\u002F\u002F propiedades personalizadas\n",{"type":33,"tag":94,"props":398,"children":400},{"class":96,"line":399},15,[401],{"type":33,"tag":94,"props":402,"children":403},{"style":111},[404],{"type":38,"value":405},"    }));\n",{"type":33,"tag":94,"props":407,"children":409},{"class":96,"line":408},16,[410],{"type":33,"tag":94,"props":411,"children":412},{"style":111},[413],{"type":38,"value":414},"  }\n",{"type":33,"tag":94,"props":416,"children":418},{"class":96,"line":417},17,[419],{"type":33,"tag":94,"props":420,"children":421},{"style":111},[422],{"type":38,"value":232},{"type":33,"tag":94,"props":424,"children":426},{"class":96,"line":425},18,[427,432,436,441],{"type":33,"tag":94,"props":428,"children":429},{"style":176},[430],{"type":38,"value":431},"  sendEvent",{"type":33,"tag":94,"props":433,"children":434},{"style":111},[435],{"type":38,"value":114},{"type":33,"tag":94,"props":437,"children":438},{"style":148},[439],{"type":38,"value":440},"'pageview'",{"type":33,"tag":94,"props":442,"children":443},{"style":111},[444],{"type":38,"value":223},{"type":33,"tag":94,"props":446,"children":448},{"class":96,"line":447},19,[449],{"type":33,"tag":94,"props":450,"children":451},{"style":111},[452],{"type":38,"value":232},{"type":33,"tag":94,"props":454,"children":456},{"class":96,"line":455},20,[457],{"type":33,"tag":94,"props":458,"children":459},{"style":101},[460],{"type":38,"value":461},"  \u002F\u002F rastreo de clics\n",{"type":33,"tag":94,"props":463,"children":465},{"class":96,"line":464},21,[466,471,476,480,485,490,495,500,505],{"type":33,"tag":94,"props":467,"children":468},{"style":111},[469],{"type":38,"value":470},"  document.",{"type":33,"tag":94,"props":472,"children":473},{"style":176},[474],{"type":38,"value":475},"addEventListener",{"type":33,"tag":94,"props":477,"children":478},{"style":111},[479],{"type":38,"value":114},{"type":33,"tag":94,"props":481,"children":482},{"style":148},[483],{"type":38,"value":484},"'click'",{"type":33,"tag":94,"props":486,"children":487},{"style":111},[488],{"type":38,"value":489},", (",{"type":33,"tag":94,"props":491,"children":492},{"style":253},[493],{"type":38,"value":494},"e",{"type":33,"tag":94,"props":496,"children":497},{"style":111},[498],{"type":38,"value":499},") ",{"type":33,"tag":94,"props":501,"children":502},{"style":117},[503],{"type":38,"value":504},"=>",{"type":33,"tag":94,"props":506,"children":507},{"style":111},[508],{"type":38,"value":509}," {\n",{"type":33,"tag":94,"props":511,"children":513},{"class":96,"line":512},22,[514,519,524,529,533,538],{"type":33,"tag":94,"props":515,"children":516},{"style":117},[517],{"type":38,"value":518},"    if",{"type":33,"tag":94,"props":520,"children":521},{"style":111},[522],{"type":38,"value":523}," (e.target.",{"type":33,"tag":94,"props":525,"children":526},{"style":176},[527],{"type":38,"value":528},"matches",{"type":33,"tag":94,"props":530,"children":531},{"style":111},[532],{"type":38,"value":114},{"type":33,"tag":94,"props":534,"children":535},{"style":148},[536],{"type":38,"value":537},"'[data-track]'",{"type":33,"tag":94,"props":539,"children":540},{"style":111},[541],{"type":38,"value":542},")) {\n",{"type":33,"tag":94,"props":544,"children":546},{"class":96,"line":545},23,[547,552,556,560],{"type":33,"tag":94,"props":548,"children":549},{"style":176},[550],{"type":38,"value":551},"      sendEvent",{"type":33,"tag":94,"props":553,"children":554},{"style":111},[555],{"type":38,"value":114},{"type":33,"tag":94,"props":557,"children":558},{"style":148},[559],{"type":38,"value":484},{"type":33,"tag":94,"props":561,"children":562},{"style":111},[563],{"type":38,"value":564},", { element: e.target.dataset.track });\n",{"type":33,"tag":94,"props":566,"children":568},{"class":96,"line":567},24,[569],{"type":33,"tag":94,"props":570,"children":571},{"style":111},[572],{"type":38,"value":573},"    }\n",{"type":33,"tag":94,"props":575,"children":577},{"class":96,"line":576},25,[578],{"type":33,"tag":94,"props":579,"children":580},{"style":111},[581],{"type":38,"value":582},"  });\n",{"type":33,"tag":94,"props":584,"children":586},{"class":96,"line":585},26,[587],{"type":33,"tag":94,"props":588,"children":589},{"style":111},[590],{"type":38,"value":591},"})();\n",{"type":33,"tag":34,"props":593,"children":594},{},[595,597,603,605,611],{"type":38,"value":596},"La API ",{"type":33,"tag":90,"props":598,"children":600},{"className":599},[],[601],{"type":38,"value":602},"navigator.sendBeacon",{"type":38,"value":604}," envía POST HTTP pero no envía cookies. El ",{"type":33,"tag":90,"props":606,"children":608},{"className":607},[],[609],{"type":38,"value":610},"sessionHash",{"type":38,"value":612}," se genera en cliente y no se persiste (se pierde al cerrar la pestaña). Este hash se usa para unir pageviews dentro de la misma sesión pero no identifica al mismo usuario en diferentes días.",{"type":33,"tag":34,"props":614,"children":615},{},[616,621],{"type":33,"tag":77,"props":617,"children":618},{},[619],{"type":38,"value":620},"Lado del servidor (escrito en Elixir\u002FPhoenix):",{"type":38,"value":622},"\nLos eventos entrantes se escriben en ClickHouse (base de datos time-series). En instalaciones auto-hospedadas, ClickHouse es por defecto; en la versión en la nube, usa ClickHouse gestionado. El esquema de tabla:",{"type":33,"tag":83,"props":624,"children":628},{"className":625,"code":626,"language":627,"meta":17,"style":17},"language-sql shiki shiki-themes github-dark","CREATE TABLE events (\n  timestamp DateTime,\n  domain String,\n  pathname String,\n  referrer String,\n  session_hash String,\n  event_name String,\n  props Map(String, String),\n  user_agent String,\n  country String,\n  device_type Enum8('desktop'=1, 'mobile'=2, 'tablet'=3)\n) ENGINE = MergeTree()\nPARTITION BY toYYYYMM(timestamp)\nORDER BY (domain, toDate(timestamp), session_hash);\n","sql",[629],{"type":33,"tag":90,"props":630,"children":631},{"__ignoreMap":17},[632,655,673,681,689,697,705,713,721,729,737,801,818,845],{"type":33,"tag":94,"props":633,"children":634},{"class":96,"line":97},[635,640,645,650],{"type":33,"tag":94,"props":636,"children":637},{"style":117},[638],{"type":38,"value":639},"CREATE",{"type":33,"tag":94,"props":641,"children":642},{"style":117},[643],{"type":38,"value":644}," TABLE",{"type":33,"tag":94,"props":646,"children":647},{"style":176},[648],{"type":38,"value":649}," events",{"type":33,"tag":94,"props":651,"children":652},{"style":111},[653],{"type":38,"value":654}," (\n",{"type":33,"tag":94,"props":656,"children":657},{"class":96,"line":107},[658,663,668],{"type":33,"tag":94,"props":659,"children":660},{"style":117},[661],{"type":38,"value":662},"  timestamp",{"type":33,"tag":94,"props":664,"children":665},{"style":117},[666],{"type":38,"value":667}," DateTime",{"type":33,"tag":94,"props":669,"children":670},{"style":111},[671],{"type":38,"value":672},",\n",{"type":33,"tag":94,"props":674,"children":675},{"class":96,"line":128},[676],{"type":33,"tag":94,"props":677,"children":678},{"style":111},[679],{"type":38,"value":680},"  domain String,\n",{"type":33,"tag":94,"props":682,"children":683},{"class":96,"line":159},[684],{"type":33,"tag":94,"props":685,"children":686},{"style":111},[687],{"type":38,"value":688},"  pathname String,\n",{"type":33,"tag":94,"props":690,"children":691},{"class":96,"line":226},[692],{"type":33,"tag":94,"props":693,"children":694},{"style":111},[695],{"type":38,"value":696},"  referrer String,\n",{"type":33,"tag":94,"props":698,"children":699},{"class":96,"line":235},[700],{"type":33,"tag":94,"props":701,"children":702},{"style":111},[703],{"type":38,"value":704},"  session_hash String,\n",{"type":33,"tag":94,"props":706,"children":707},{"class":96,"line":278},[708],{"type":33,"tag":94,"props":709,"children":710},{"style":111},[711],{"type":38,"value":712},"  event_name String,\n",{"type":33,"tag":94,"props":714,"children":715},{"class":96,"line":317},[716],{"type":33,"tag":94,"props":717,"children":718},{"style":111},[719],{"type":38,"value":720},"  props Map(String, String),\n",{"type":33,"tag":94,"props":722,"children":723},{"class":96,"line":27},[724],{"type":33,"tag":94,"props":725,"children":726},{"style":111},[727],{"type":38,"value":728},"  user_agent String,\n",{"type":33,"tag":94,"props":730,"children":731},{"class":96,"line":344},[732],{"type":33,"tag":94,"props":733,"children":734},{"style":111},[735],{"type":38,"value":736},"  country String,\n",{"type":33,"tag":94,"props":738,"children":739},{"class":96,"line":353},[740,745,750,755,760,764,769,773,778,782,787,791,796],{"type":33,"tag":94,"props":741,"children":742},{"style":111},[743],{"type":38,"value":744},"  device_type Enum8(",{"type":33,"tag":94,"props":746,"children":747},{"style":148},[748],{"type":38,"value":749},"'desktop'",{"type":33,"tag":94,"props":751,"children":752},{"style":117},[753],{"type":38,"value":754},"=",{"type":33,"tag":94,"props":756,"children":757},{"style":137},[758],{"type":38,"value":759},"1",{"type":33,"tag":94,"props":761,"children":762},{"style":111},[763],{"type":38,"value":261},{"type":33,"tag":94,"props":765,"children":766},{"style":148},[767],{"type":38,"value":768},"'mobile'",{"type":33,"tag":94,"props":770,"children":771},{"style":117},[772],{"type":38,"value":754},{"type":33,"tag":94,"props":774,"children":775},{"style":137},[776],{"type":38,"value":777},"2",{"type":33,"tag":94,"props":779,"children":780},{"style":111},[781],{"type":38,"value":261},{"type":33,"tag":94,"props":783,"children":784},{"style":148},[785],{"type":38,"value":786},"'tablet'",{"type":33,"tag":94,"props":788,"children":789},{"style":117},[790],{"type":38,"value":754},{"type":33,"tag":94,"props":792,"children":793},{"style":137},[794],{"type":38,"value":795},"3",{"type":33,"tag":94,"props":797,"children":798},{"style":111},[799],{"type":38,"value":800},")\n",{"type":33,"tag":94,"props":802,"children":803},{"class":96,"line":362},[804,809,813],{"type":33,"tag":94,"props":805,"children":806},{"style":111},[807],{"type":38,"value":808},") ENGINE ",{"type":33,"tag":94,"props":810,"children":811},{"style":117},[812],{"type":38,"value":754},{"type":33,"tag":94,"props":814,"children":815},{"style":111},[816],{"type":38,"value":817}," MergeTree()\n",{"type":33,"tag":94,"props":819,"children":820},{"class":96,"line":371},[821,826,831,836,841],{"type":33,"tag":94,"props":822,"children":823},{"style":117},[824],{"type":38,"value":825},"PARTITION",{"type":33,"tag":94,"props":827,"children":828},{"style":117},[829],{"type":38,"value":830}," BY",{"type":33,"tag":94,"props":832,"children":833},{"style":111},[834],{"type":38,"value":835}," toYYYYMM(",{"type":33,"tag":94,"props":837,"children":838},{"style":117},[839],{"type":38,"value":840},"timestamp",{"type":33,"tag":94,"props":842,"children":843},{"style":111},[844],{"type":38,"value":800},{"type":33,"tag":94,"props":846,"children":847},{"class":96,"line":385},[848,853,858,862],{"type":33,"tag":94,"props":849,"children":850},{"style":117},[851],{"type":38,"value":852},"ORDER BY",{"type":33,"tag":94,"props":854,"children":855},{"style":111},[856],{"type":38,"value":857}," (domain, toDate(",{"type":33,"tag":94,"props":859,"children":860},{"style":117},[861],{"type":38,"value":840},{"type":33,"tag":94,"props":863,"children":864},{"style":111},[865],{"type":38,"value":866},"), session_hash);\n",{"type":33,"tag":34,"props":868,"children":869},{},[870],{"type":38,"value":871},"Las queries de aggregación en el motor MergeTree de ClickHouse son muy rápidas: en una tabla con 100M eventos, una query de \"sesiones únicas por día\" devuelve resultados en 200-400 ms.",{"type":33,"tag":41,"props":873,"children":875},{"id":874},"aggregation-en-servidor-sesión-cohorte-retención",[876],{"type":38,"value":877},"Aggregation en Servidor: Sesión → Cohorte → Retención",{"type":33,"tag":34,"props":879,"children":880},{},[881,883,888],{"type":38,"value":882},"El dashboard de Plausible muestra \"sesiones únicas\" en lugar de \"visitantes únicos\". Pero en análisis de marketing, sesión no es suficiente — para retención por cohorte, proyección de LTV y atribución de campañas se necesita identificación de usuario. La forma de hacerlo sin cookies es: ",{"type":33,"tag":77,"props":884,"children":885},{},[886],{"type":38,"value":887},"server-side identity resolution + capa de aggregation",{"type":38,"value":304},{"type":33,"tag":34,"props":890,"children":891},{},[892,894,900],{"type":38,"value":893},"Escenario: un sitio de e-commerce recopila eventos con Plausible y los exporta a BigQuery. Cuando el usuario inicia sesión, se envía ",{"type":33,"tag":90,"props":895,"children":897},{"className":896},[],[898],{"type":38,"value":899},"user_id",{"type":38,"value":901}," como propiedad personalizada:",{"type":33,"tag":83,"props":903,"children":905},{"className":85,"code":904,"language":87,"meta":17,"style":17},"\u002F\u002F después del login en página de checkout\nplausible('Login', { props: { user_id: '{{user.id}}' } });\n",[906],{"type":33,"tag":90,"props":907,"children":908},{"__ignoreMap":17},[909,917],{"type":33,"tag":94,"props":910,"children":911},{"class":96,"line":97},[912],{"type":33,"tag":94,"props":913,"children":914},{"style":101},[915],{"type":38,"value":916},"\u002F\u002F después del login en página de checkout\n",{"type":33,"tag":94,"props":918,"children":919},{"class":96,"line":107},[920,924,928,933,938,943],{"type":33,"tag":94,"props":921,"children":922},{"style":176},[923],{"type":38,"value":23},{"type":33,"tag":94,"props":925,"children":926},{"style":111},[927],{"type":38,"value":114},{"type":33,"tag":94,"props":929,"children":930},{"style":148},[931],{"type":38,"value":932},"'Login'",{"type":33,"tag":94,"props":934,"children":935},{"style":111},[936],{"type":38,"value":937},", { props: { user_id: ",{"type":33,"tag":94,"props":939,"children":940},{"style":148},[941],{"type":38,"value":942},"'{{user.id}}'",{"type":33,"tag":94,"props":944,"children":945},{"style":111},[946],{"type":38,"value":947}," } });\n",{"type":33,"tag":34,"props":949,"children":950},{},[951,953,958],{"type":38,"value":952},"En BigQuery, un job batch diario une eventos de Plausible con ",{"type":33,"tag":90,"props":954,"children":956},{"className":955},[],[957],{"type":38,"value":899},{"type":38,"value":959},":",{"type":33,"tag":83,"props":961,"children":963},{"className":625,"code":962,"language":627,"meta":17,"style":17},"-- modelo dbt: user_sessions_daily.sql\nWITH raw_events AS (\n  SELECT\n    timestamp,\n    session_hash,\n    JSON_EXTRACT_SCALAR(props, '$.user_id') AS user_id,\n    pathname,\n    event_name\n  FROM `analytics.plausible_events`\n  WHERE DATE(timestamp) = CURRENT_DATE - 1\n),\nidentified_sessions AS (\n  SELECT\n    session_hash,\n    FIRST_VALUE(user_id IGNORE NULLS) OVER (\n      PARTITION BY session_hash ORDER BY timestamp\n    ) AS resolved_user_id\n  FROM raw_events\n)\nSELECT\n  e.timestamp,\n  e.session_hash,\n  COALESCE(i.resolved_user_id, e.session_hash) AS user_key,\n  e.pathname,\n  e.event_name\nFROM raw_events e\nLEFT JOIN identified_sessions i USING (session_hash);\n",[964],{"type":33,"tag":90,"props":965,"children":966},{"__ignoreMap":17},[967,975,997,1005,1017,1025,1051,1059,1067,1080,1124,1132,1148,1155,1162,1198,1224,1241,1253,1260,1268,1288,1308,1363,1383,1399,1412],{"type":33,"tag":94,"props":968,"children":969},{"class":96,"line":97},[970],{"type":33,"tag":94,"props":971,"children":972},{"style":101},[973],{"type":38,"value":974},"-- modelo dbt: user_sessions_daily.sql\n",{"type":33,"tag":94,"props":976,"children":977},{"class":96,"line":107},[978,983,988,993],{"type":33,"tag":94,"props":979,"children":980},{"style":117},[981],{"type":38,"value":982},"WITH",{"type":33,"tag":94,"props":984,"children":985},{"style":111},[986],{"type":38,"value":987}," raw_events ",{"type":33,"tag":94,"props":989,"children":990},{"style":117},[991],{"type":38,"value":992},"AS",{"type":33,"tag":94,"props":994,"children":995},{"style":111},[996],{"type":38,"value":654},{"type":33,"tag":94,"props":998,"children":999},{"class":96,"line":128},[1000],{"type":33,"tag":94,"props":1001,"children":1002},{"style":117},[1003],{"type":38,"value":1004},"  SELECT\n",{"type":33,"tag":94,"props":1006,"children":1007},{"class":96,"line":159},[1008,1013],{"type":33,"tag":94,"props":1009,"children":1010},{"style":117},[1011],{"type":38,"value":1012},"    timestamp",{"type":33,"tag":94,"props":1014,"children":1015},{"style":111},[1016],{"type":38,"value":672},{"type":33,"tag":94,"props":1018,"children":1019},{"class":96,"line":226},[1020],{"type":33,"tag":94,"props":1021,"children":1022},{"style":111},[1023],{"type":38,"value":1024},"    session_hash,\n",{"type":33,"tag":94,"props":1026,"children":1027},{"class":96,"line":235},[1028,1033,1038,1042,1046],{"type":33,"tag":94,"props":1029,"children":1030},{"style":111},[1031],{"type":38,"value":1032},"    JSON_EXTRACT_SCALAR(props, ",{"type":33,"tag":94,"props":1034,"children":1035},{"style":148},[1036],{"type":38,"value":1037},"'$.user_id'",{"type":33,"tag":94,"props":1039,"children":1040},{"style":111},[1041],{"type":38,"value":499},{"type":33,"tag":94,"props":1043,"children":1044},{"style":117},[1045],{"type":38,"value":992},{"type":33,"tag":94,"props":1047,"children":1048},{"style":111},[1049],{"type":38,"value":1050}," user_id,\n",{"type":33,"tag":94,"props":1052,"children":1053},{"class":96,"line":278},[1054],{"type":33,"tag":94,"props":1055,"children":1056},{"style":111},[1057],{"type":38,"value":1058},"    pathname,\n",{"type":33,"tag":94,"props":1060,"children":1061},{"class":96,"line":317},[1062],{"type":33,"tag":94,"props":1063,"children":1064},{"style":111},[1065],{"type":38,"value":1066},"    event_name\n",{"type":33,"tag":94,"props":1068,"children":1069},{"class":96,"line":27},[1070,1075],{"type":33,"tag":94,"props":1071,"children":1072},{"style":117},[1073],{"type":38,"value":1074},"  FROM",{"type":33,"tag":94,"props":1076,"children":1077},{"style":148},[1078],{"type":38,"value":1079}," `analytics.plausible_events`\n",{"type":33,"tag":94,"props":1081,"children":1082},{"class":96,"line":344},[1083,1088,1093,1097,1101,1105,1109,1114,1119],{"type":33,"tag":94,"props":1084,"children":1085},{"style":117},[1086],{"type":38,"value":1087},"  WHERE",{"type":33,"tag":94,"props":1089,"children":1090},{"style":117},[1091],{"type":38,"value":1092}," DATE",{"type":33,"tag":94,"props":1094,"children":1095},{"style":111},[1096],{"type":38,"value":114},{"type":33,"tag":94,"props":1098,"children":1099},{"style":117},[1100],{"type":38,"value":840},{"type":33,"tag":94,"props":1102,"children":1103},{"style":111},[1104],{"type":38,"value":499},{"type":33,"tag":94,"props":1106,"children":1107},{"style":117},[1108],{"type":38,"value":754},{"type":33,"tag":94,"props":1110,"children":1111},{"style":111},[1112],{"type":38,"value":1113}," CURRENT_DATE ",{"type":33,"tag":94,"props":1115,"children":1116},{"style":117},[1117],{"type":38,"value":1118},"-",{"type":33,"tag":94,"props":1120,"children":1121},{"style":137},[1122],{"type":38,"value":1123}," 1\n",{"type":33,"tag":94,"props":1125,"children":1126},{"class":96,"line":353},[1127],{"type":33,"tag":94,"props":1128,"children":1129},{"style":111},[1130],{"type":38,"value":1131},"),\n",{"type":33,"tag":94,"props":1133,"children":1134},{"class":96,"line":362},[1135,1140,1144],{"type":33,"tag":94,"props":1136,"children":1137},{"style":111},[1138],{"type":38,"value":1139},"identified_sessions ",{"type":33,"tag":94,"props":1141,"children":1142},{"style":117},[1143],{"type":38,"value":992},{"type":33,"tag":94,"props":1145,"children":1146},{"style":111},[1147],{"type":38,"value":654},{"type":33,"tag":94,"props":1149,"children":1150},{"class":96,"line":371},[1151],{"type":33,"tag":94,"props":1152,"children":1153},{"style":117},[1154],{"type":38,"value":1004},{"type":33,"tag":94,"props":1156,"children":1157},{"class":96,"line":385},[1158],{"type":33,"tag":94,"props":1159,"children":1160},{"style":111},[1161],{"type":38,"value":1024},{"type":33,"tag":94,"props":1163,"children":1164},{"class":96,"line":399},[1165,1170,1175,1180,1185,1189,1194],{"type":33,"tag":94,"props":1166,"children":1167},{"style":137},[1168],{"type":38,"value":1169},"    FIRST_VALUE",{"type":33,"tag":94,"props":1171,"children":1172},{"style":111},[1173],{"type":38,"value":1174},"(user_id ",{"type":33,"tag":94,"props":1176,"children":1177},{"style":117},[1178],{"type":38,"value":1179},"IGNORE",{"type":33,"tag":94,"props":1181,"children":1182},{"style":117},[1183],{"type":38,"value":1184}," NULLS",{"type":33,"tag":94,"props":1186,"children":1187},{"style":111},[1188],{"type":38,"value":499},{"type":33,"tag":94,"props":1190,"children":1191},{"style":117},[1192],{"type":38,"value":1193},"OVER",{"type":33,"tag":94,"props":1195,"children":1196},{"style":111},[1197],{"type":38,"value":654},{"type":33,"tag":94,"props":1199,"children":1200},{"class":96,"line":408},[1201,1206,1210,1215,1219],{"type":33,"tag":94,"props":1202,"children":1203},{"style":117},[1204],{"type":38,"value":1205},"      PARTITION",{"type":33,"tag":94,"props":1207,"children":1208},{"style":117},[1209],{"type":38,"value":830},{"type":33,"tag":94,"props":1211,"children":1212},{"style":111},[1213],{"type":38,"value":1214}," session_hash ",{"type":33,"tag":94,"props":1216,"children":1217},{"style":117},[1218],{"type":38,"value":852},{"type":33,"tag":94,"props":1220,"children":1221},{"style":117},[1222],{"type":38,"value":1223}," timestamp\n",{"type":33,"tag":94,"props":1225,"children":1226},{"class":96,"line":417},[1227,1232,1236],{"type":33,"tag":94,"props":1228,"children":1229},{"style":111},[1230],{"type":38,"value":1231},"    ) ",{"type":33,"tag":94,"props":1233,"children":1234},{"style":117},[1235],{"type":38,"value":992},{"type":33,"tag":94,"props":1237,"children":1238},{"style":111},[1239],{"type":38,"value":1240}," resolved_user_id\n",{"type":33,"tag":94,"props":1242,"children":1243},{"class":96,"line":425},[1244,1248],{"type":33,"tag":94,"props":1245,"children":1246},{"style":117},[1247],{"type":38,"value":1074},{"type":33,"tag":94,"props":1249,"children":1250},{"style":111},[1251],{"type":38,"value":1252}," raw_events\n",{"type":33,"tag":94,"props":1254,"children":1255},{"class":96,"line":447},[1256],{"type":33,"tag":94,"props":1257,"children":1258},{"style":111},[1259],{"type":38,"value":800},{"type":33,"tag":94,"props":1261,"children":1262},{"class":96,"line":455},[1263],{"type":33,"tag":94,"props":1264,"children":1265},{"style":117},[1266],{"type":38,"value":1267},"SELECT\n",{"type":33,"tag":94,"props":1269,"children":1270},{"class":96,"line":464},[1271,1276,1280,1284],{"type":33,"tag":94,"props":1272,"children":1273},{"style":137},[1274],{"type":38,"value":1275},"  e",{"type":33,"tag":94,"props":1277,"children":1278},{"style":111},[1279],{"type":38,"value":304},{"type":33,"tag":94,"props":1281,"children":1282},{"style":137},[1283],{"type":38,"value":840},{"type":33,"tag":94,"props":1285,"children":1286},{"style":111},[1287],{"type":38,"value":672},{"type":33,"tag":94,"props":1289,"children":1290},{"class":96,"line":512},[1291,1295,1299,1304],{"type":33,"tag":94,"props":1292,"children":1293},{"style":137},[1294],{"type":38,"value":1275},{"type":33,"tag":94,"props":1296,"children":1297},{"style":111},[1298],{"type":38,"value":304},{"type":33,"tag":94,"props":1300,"children":1301},{"style":137},[1302],{"type":38,"value":1303},"session_hash",{"type":33,"tag":94,"props":1305,"children":1306},{"style":111},[1307],{"type":38,"value":672},{"type":33,"tag":94,"props":1309,"children":1310},{"class":96,"line":545},[1311,1316,1320,1325,1329,1334,1338,1342,1346,1350,1354,1358],{"type":33,"tag":94,"props":1312,"children":1313},{"style":137},[1314],{"type":38,"value":1315},"  COALESCE",{"type":33,"tag":94,"props":1317,"children":1318},{"style":111},[1319],{"type":38,"value":114},{"type":33,"tag":94,"props":1321,"children":1322},{"style":137},[1323],{"type":38,"value":1324},"i",{"type":33,"tag":94,"props":1326,"children":1327},{"style":111},[1328],{"type":38,"value":304},{"type":33,"tag":94,"props":1330,"children":1331},{"style":137},[1332],{"type":38,"value":1333},"resolved_user_id",{"type":33,"tag":94,"props":1335,"children":1336},{"style":111},[1337],{"type":38,"value":261},{"type":33,"tag":94,"props":1339,"children":1340},{"style":137},[1341],{"type":38,"value":494},{"type":33,"tag":94,"props":1343,"children":1344},{"style":111},[1345],{"type":38,"value":304},{"type":33,"tag":94,"props":1347,"children":1348},{"style":137},[1349],{"type":38,"value":1303},{"type":33,"tag":94,"props":1351,"children":1352},{"style":111},[1353],{"type":38,"value":499},{"type":33,"tag":94,"props":1355,"children":1356},{"style":117},[1357],{"type":38,"value":992},{"type":33,"tag":94,"props":1359,"children":1360},{"style":111},[1361],{"type":38,"value":1362}," user_key,\n",{"type":33,"tag":94,"props":1364,"children":1365},{"class":96,"line":567},[1366,1370,1374,1379],{"type":33,"tag":94,"props":1367,"children":1368},{"style":137},[1369],{"type":38,"value":1275},{"type":33,"tag":94,"props":1371,"children":1372},{"style":111},[1373],{"type":38,"value":304},{"type":33,"tag":94,"props":1375,"children":1376},{"style":137},[1377],{"type":38,"value":1378},"pathname",{"type":33,"tag":94,"props":1380,"children":1381},{"style":111},[1382],{"type":38,"value":672},{"type":33,"tag":94,"props":1384,"children":1385},{"class":96,"line":576},[1386,1390,1394],{"type":33,"tag":94,"props":1387,"children":1388},{"style":137},[1389],{"type":38,"value":1275},{"type":33,"tag":94,"props":1391,"children":1392},{"style":111},[1393],{"type":38,"value":304},{"type":33,"tag":94,"props":1395,"children":1396},{"style":137},[1397],{"type":38,"value":1398},"event_name\n",{"type":33,"tag":94,"props":1400,"children":1401},{"class":96,"line":585},[1402,1407],{"type":33,"tag":94,"props":1403,"children":1404},{"style":117},[1405],{"type":38,"value":1406},"FROM",{"type":33,"tag":94,"props":1408,"children":1409},{"style":111},[1410],{"type":38,"value":1411}," raw_events e\n",{"type":33,"tag":94,"props":1413,"children":1415},{"class":96,"line":1414},27,[1416,1421,1426,1431],{"type":33,"tag":94,"props":1417,"children":1418},{"style":117},[1419],{"type":38,"value":1420},"LEFT JOIN",{"type":33,"tag":94,"props":1422,"children":1423},{"style":111},[1424],{"type":38,"value":1425}," identified_sessions i ",{"type":33,"tag":94,"props":1427,"children":1428},{"style":117},[1429],{"type":38,"value":1430},"USING",{"type":33,"tag":94,"props":1432,"children":1433},{"style":111},[1434],{"type":38,"value":1435}," (session_hash);\n",{"type":33,"tag":34,"props":1437,"children":1438},{},[1439,1441,1447,1449,1454,1456,1461,1463,1468],{"type":38,"value":1440},"En este modelo, ",{"type":33,"tag":90,"props":1442,"children":1444},{"className":1443},[],[1445],{"type":38,"value":1446},"user_key",{"type":38,"value":1448}," es ",{"type":33,"tag":90,"props":1450,"children":1452},{"className":1451},[],[1453],{"type":38,"value":899},{"type":38,"value":1455}," para usuarios autenticados o ",{"type":33,"tag":90,"props":1457,"children":1459},{"className":1458},[],[1460],{"type":38,"value":1303},{"type":38,"value":1462}," para sesiones anónimas. Ahora la retención se puede calcular sobre ",{"type":33,"tag":90,"props":1464,"children":1466},{"className":1465},[],[1467],{"type":38,"value":1446},{"type":38,"value":959},{"type":33,"tag":83,"props":1470,"children":1472},{"className":625,"code":1471,"language":627,"meta":17,"style":17},"-- cohorte de retención a 7 días\nSELECT\n  DATE_TRUNC(first_seen, WEEK) AS cohort_week,\n  COUNT(DISTINCT user_key) AS cohort_size,\n  COUNT(DISTINCT CASE WHEN day_7_active THEN user_key END) AS retained_d7,\n  SAFE_DIVIDE(\n    COUNT(DISTINCT CASE WHEN day_7_active THEN user_key END),\n    COUNT(DISTINCT user_key)\n  ) AS retention_rate\nFROM user_retention_facts\nGROUP BY 1;\n",[1473],{"type":33,"tag":90,"props":1474,"children":1475},{"__ignoreMap":17},[1476,1484,1491,1517,1548,1606,1614,1658,1678,1695,1707],{"type":33,"tag":94,"props":1477,"children":1478},{"class":96,"line":97},[1479],{"type":33,"tag":94,"props":1480,"children":1481},{"style":101},[1482],{"type":38,"value":1483},"-- cohorte de retención a 7 días\n",{"type":33,"tag":94,"props":1485,"children":1486},{"class":96,"line":107},[1487],{"type":33,"tag":94,"props":1488,"children":1489},{"style":117},[1490],{"type":38,"value":1267},{"type":33,"tag":94,"props":1492,"children":1493},{"class":96,"line":128},[1494,1499,1504,1508,1512],{"type":33,"tag":94,"props":1495,"children":1496},{"style":111},[1497],{"type":38,"value":1498},"  DATE_TRUNC(first_seen, ",{"type":33,"tag":94,"props":1500,"children":1501},{"style":117},[1502],{"type":38,"value":1503},"WEEK",{"type":33,"tag":94,"props":1505,"children":1506},{"style":111},[1507],{"type":38,"value":499},{"type":33,"tag":94,"props":1509,"children":1510},{"style":117},[1511],{"type":38,"value":992},{"type":33,"tag":94,"props":1513,"children":1514},{"style":111},[1515],{"type":38,"value":1516}," cohort_week,\n",{"type":33,"tag":94,"props":1518,"children":1519},{"class":96,"line":159},[1520,1525,1529,1534,1539,1543],{"type":33,"tag":94,"props":1521,"children":1522},{"style":137},[1523],{"type":38,"value":1524},"  COUNT",{"type":33,"tag":94,"props":1526,"children":1527},{"style":111},[1528],{"type":38,"value":114},{"type":33,"tag":94,"props":1530,"children":1531},{"style":117},[1532],{"type":38,"value":1533},"DISTINCT",{"type":33,"tag":94,"props":1535,"children":1536},{"style":111},[1537],{"type":38,"value":1538}," user_key) ",{"type":33,"tag":94,"props":1540,"children":1541},{"style":117},[1542],{"type":38,"value":992},{"type":33,"tag":94,"props":1544,"children":1545},{"style":111},[1546],{"type":38,"value":1547}," cohort_size,\n",{"type":33,"tag":94,"props":1549,"children":1550},{"class":96,"line":226},[1551,1555,1559,1563,1568,1573,1578,1583,1588,1593,1597,1601],{"type":33,"tag":94,"props":1552,"children":1553},{"style":137},[1554],{"type":38,"value":1524},{"type":33,"tag":94,"props":1556,"children":1557},{"style":111},[1558],{"type":38,"value":114},{"type":33,"tag":94,"props":1560,"children":1561},{"style":117},[1562],{"type":38,"value":1533},{"type":33,"tag":94,"props":1564,"children":1565},{"style":117},[1566],{"type":38,"value":1567}," CASE",{"type":33,"tag":94,"props":1569,"children":1570},{"style":117},[1571],{"type":38,"value":1572}," WHEN",{"type":33,"tag":94,"props":1574,"children":1575},{"style":111},[1576],{"type":38,"value":1577}," day_7_active ",{"type":33,"tag":94,"props":1579,"children":1580},{"style":117},[1581],{"type":38,"value":1582},"THEN",{"type":33,"tag":94,"props":1584,"children":1585},{"style":111},[1586],{"type":38,"value":1587}," user_key ",{"type":33,"tag":94,"props":1589,"children":1590},{"style":117},[1591],{"type":38,"value":1592},"END",{"type":33,"tag":94,"props":1594,"children":1595},{"style":111},[1596],{"type":38,"value":499},{"type":33,"tag":94,"props":1598,"children":1599},{"style":117},[1600],{"type":38,"value":992},{"type":33,"tag":94,"props":1602,"children":1603},{"style":111},[1604],{"type":38,"value":1605}," retained_d7,\n",{"type":33,"tag":94,"props":1607,"children":1608},{"class":96,"line":235},[1609],{"type":33,"tag":94,"props":1610,"children":1611},{"style":111},[1612],{"type":38,"value":1613},"  SAFE_DIVIDE(\n",{"type":33,"tag":94,"props":1615,"children":1616},{"class":96,"line":278},[1617,1622,1626,1630,1634,1638,1642,1646,1650,1654],{"type":33,"tag":94,"props":1618,"children":1619},{"style":137},[1620],{"type":38,"value":1621},"    COUNT",{"type":33,"tag":94,"props":1623,"children":1624},{"style":111},[1625],{"type":38,"value":114},{"type":33,"tag":94,"props":1627,"children":1628},{"style":117},[1629],{"type":38,"value":1533},{"type":33,"tag":94,"props":1631,"children":1632},{"style":117},[1633],{"type":38,"value":1567},{"type":33,"tag":94,"props":1635,"children":1636},{"style":117},[1637],{"type":38,"value":1572},{"type":33,"tag":94,"props":1639,"children":1640},{"style":111},[1641],{"type":38,"value":1577},{"type":33,"tag":94,"props":1643,"children":1644},{"style":117},[1645],{"type":38,"value":1582},{"type":33,"tag":94,"props":1647,"children":1648},{"style":111},[1649],{"type":38,"value":1587},{"type":33,"tag":94,"props":1651,"children":1652},{"style":117},[1653],{"type":38,"value":1592},{"type":33,"tag":94,"props":1655,"children":1656},{"style":111},[1657],{"type":38,"value":1131},{"type":33,"tag":94,"props":1659,"children":1660},{"class":96,"line":317},[1661,1665,1669,1673],{"type":33,"tag":94,"props":1662,"children":1663},{"style":137},[1664],{"type":38,"value":1621},{"type":33,"tag":94,"props":1666,"children":1667},{"style":111},[1668],{"type":38,"value":114},{"type":33,"tag":94,"props":1670,"children":1671},{"style":117},[1672],{"type":38,"value":1533},{"type":33,"tag":94,"props":1674,"children":1675},{"style":111},[1676],{"type":38,"value":1677}," user_key)\n",{"type":33,"tag":94,"props":1679,"children":1680},{"class":96,"line":27},[1681,1686,1690],{"type":33,"tag":94,"props":1682,"children":1683},{"style":111},[1684],{"type":38,"value":1685},"  ) ",{"type":33,"tag":94,"props":1687,"children":1688},{"style":117},[1689],{"type":38,"value":992},{"type":33,"tag":94,"props":1691,"children":1692},{"style":111},[1693],{"type":38,"value":1694}," retention_rate\n",{"type":33,"tag":94,"props":1696,"children":1697},{"class":96,"line":344},[1698,1702],{"type":33,"tag":94,"props":1699,"children":1700},{"style":117},[1701],{"type":38,"value":1406},{"type":33,"tag":94,"props":1703,"children":1704},{"style":111},[1705],{"type":38,"value":1706}," user_retention_facts\n",{"type":33,"tag":94,"props":1708,"children":1709},{"class":96,"line":353},[1710,1715,1720],{"type":33,"tag":94,"props":1711,"children":1712},{"style":117},[1713],{"type":38,"value":1714},"GROUP BY",{"type":33,"tag":94,"props":1716,"children":1717},{"style":137},[1718],{"type":38,"value":1719}," 1",{"type":33,"tag":94,"props":1721,"children":1722},{"style":111},[1723],{"type":38,"value":156},{"type":33,"tag":34,"props":1725,"children":1726},{},[1727],{"type":38,"value":1728},"Las sesiones anónimas se incluyen en este análisis de cohorte pero se excluyen del cálculo de LTV a largo plazo porque no podemos rastrear al mismo usuario en diferentes días. En un sitio con tasa de login del 30%, aún podemos medir la retención basada en usuarios reales del 30% de la cohorte — profundidad similar a la tasa de consentimiento de GA4 del 35-40% pero con riesgo cero de incumplimiento RGPD.",{"type":33,"tag":41,"props":1730,"children":1732},{"id":1731},"comparación-con-ga4-cumplimiento-vs-granularidad",[1733],{"type":38,"value":1734},"Comparación con GA4: Cumplimiento vs. Granularidad",{"type":33,"tag":34,"props":1736,"children":1737},{},[1738],{"type":38,"value":1739},"Ventajas de GA4:",{"type":33,"tag":1741,"props":1742,"children":1743},"ul",{},[1744,1750,1755,1760],{"type":33,"tag":1745,"props":1746,"children":1747},"li",{},[1748],{"type":38,"value":1749},"User ID + Google Signals rastreo multi-dispositivo (si hay consentimiento)",{"type":33,"tag":1745,"props":1751,"children":1752},{},[1753],{"type":38,"value":1754},"Exportación BigQuery nativa, esquema estable",{"type":33,"tag":1745,"props":1756,"children":1757},{},[1758],{"type":38,"value":1759},"Reportes funnel, exploración de rutas listos en UI",{"type":33,"tag":1745,"props":1761,"children":1762},{},[1763],{"type":38,"value":1764},"Integración Google Ads un click",{"type":33,"tag":34,"props":1766,"children":1767},{},[1768],{"type":38,"value":1769},"Desventajas de GA4:",{"type":33,"tag":1741,"props":1771,"children":1772},{},[1773,1778,1783,1788],{"type":33,"tag":1745,"props":1774,"children":1775},{},[1776],{"type":38,"value":1777},"Consent Mode v2 obligatorio → datos modelados cuando consent_status=denied",{"type":33,"tag":1745,"props":1779,"children":1780},{},[1781],{"type":38,"value":1782},"Retención ID de usuario 360 días (reset después de 14 meses)",{"type":33,"tag":1745,"props":1784,"children":1785},{},[1786],{"type":38,"value":1787},"Tamaño script 43 KB (30 veces Plausible)",{"type":33,"tag":1745,"props":1789,"children":1790},{},[1791],{"type":38,"value":1792},"ClickStream export requiere GA360 (€150K\u002Faño)",{"type":33,"tag":34,"props":1794,"children":1795},{},[1796],{"type":38,"value":1797},"Ventajas de Plausible + stack servidor:",{"type":33,"tag":1741,"props":1799,"children":1800},{},[1801,1806,1811,1816],{"type":33,"tag":1745,"props":1802,"children":1803},{},[1804],{"type":38,"value":1805},"Sin cookies → banner RGPD consentimiento opcional (se simplifica mucho)",{"type":33,"tag":1745,"props":1807,"children":1808},{},[1809],{"type":38,"value":1810},"Propiedad de eventos: datos brutos bajo tu control (ClickHouse, BigQuery, S3)",{"type":33,"tag":1745,"props":1812,"children":1813},{},[1814],{"type":38,"value":1815},"Script ligero → impacto en tiempo de carga \u003C5ms",{"type":33,"tag":1745,"props":1817,"children":1818},{},[1819],{"type":38,"value":1820},"Opción auto-hospedada (datos no salen de EU)",{"type":33,"tag":34,"props":1822,"children":1823},{},[1824],{"type":38,"value":1825},"Desventajas de Plausible:",{"type":33,"tag":1741,"props":1827,"children":1828},{},[1829,1834,1839],{"type":33,"tag":1745,"props":1830,"children":1831},{},[1832],{"type":38,"value":1833},"Sin rastreo multi-dispositivo (para usuarios sin login)",{"type":33,"tag":1745,"props":1835,"children":1836},{},[1837],{"type":38,"value":1838},"Funnel\u002Fanálisis de rutas requieren SQL adicional",{"type":33,"tag":1745,"props":1840,"children":1841},{},[1842],{"type":38,"value":1843},"Integración Google Ads\u002FMeta Conversion API necesita pipeline personalizado",{"type":33,"tag":34,"props":1845,"children":1846},{},[1847],{"type":33,"tag":77,"props":1848,"children":1849},{},[1850],{"type":38,"value":1851},"Comparación de costos (100M eventos\u002Fmes):",{"type":33,"tag":1741,"props":1853,"children":1854},{},[1855,1860,1865,1870],{"type":33,"tag":1745,"props":1856,"children":1857},{},[1858],{"type":38,"value":1859},"GA4 estándar: Gratis pero sin BigQuery export (€150K\u002Faño en 360)",{"type":33,"tag":1745,"props":1861,"children":1862},{},[1863],{"type":38,"value":1864},"Plausible Cloud: Plan Business €200\u002Fmes (límite 200K pageviews\u002Fmes, auto-hospedado para exceso)",{"type":33,"tag":1745,"props":1866,"children":1867},{},[1868],{"type":38,"value":1869},"Auto-hospedado Plausible + ClickHouse (AWS c6g.2xlarge + 500GB SSD): ~€350\u002Fmes",{"type":33,"tag":1745,"props":1871,"children":1872},{},[1873],{"type":38,"value":1874},"Job BigQuery batch diario (aggregation): ~€80\u002Fmes",{"type":33,"tag":34,"props":1876,"children":1877},{},[1878],{"type":38,"value":1879},"Stack Plausible total: ~€430\u002Fmes. GA360: €12.5K\u002Fmes. Diferencia de costo 30x.",{"type":33,"tag":41,"props":1881,"children":1883},{"id":1882},"capa-de-identity-resolution-probabilistic-match",[1884],{"type":38,"value":1885},"Capa de Identity Resolution: Probabilistic Match",{"type":33,"tag":34,"props":1887,"children":1888},{},[1889,1891,1896],{"type":38,"value":1890},"Para identificar incluso a usuarios sin login más allá de una sesión, se puede usar probabilistic identity resolution. El fingerprinting está prohibido (RGPD, ePrivacy) pero ",{"type":33,"tag":77,"props":1892,"children":1893},{},[1894],{"type":38,"value":1895},"server-side signal aggregation",{"type":38,"value":1897}," logra resultados similares.",{"type":33,"tag":34,"props":1899,"children":1900},{},[1901,1903,1909],{"type":38,"value":1902},"El ejemplo combina ",{"type":33,"tag":90,"props":1904,"children":1906},{"className":1905},[],[1907],{"type":38,"value":1908},"user_agent + IP subnet + timezone + screen resolution",{"type":38,"value":1910}," en un hash:",{"type":33,"tag":83,"props":1912,"children":1914},{"className":625,"code":1913,"language":627,"meta":17,"style":17},"-- BigQuery UDF: probabilistic_user_id\nCREATE TEMP FUNCTION probabilistic_user_id(ua STRING, ip STRING, tz STRING, res STRING)\nRETURNS STRING\nAS (\n  TO_BASE64(SHA256(CONCAT(\n    REGEXP_EXTRACT(ua, r'^[^\u002F]+'),  -- familia del navegador\n    NET.IP_TRUNC(NET.SAFE_IP_FROM_STRING(ip), 24),  -- subnet \u002F24\n    tz,\n    res\n  )))\n);\n\nSELECT\n  timestamp,\n  session_hash,\n  probabilistic_user_id(user_agent, ip_address, timezone, screen_resolution) AS prob_user_id\nFROM plausible_events;\n",[1915],{"type":33,"tag":90,"props":1916,"children":1917},{"__ignoreMap":17},[1918,1926,1948,1961,1972,1990,2013,2067,2075,2083,2091,2098,2107,2114,2125,2133,2150],{"type":33,"tag":94,"props":1919,"children":1920},{"class":96,"line":97},[1921],{"type":33,"tag":94,"props":1922,"children":1923},{"style":101},[1924],{"type":38,"value":1925},"-- BigQuery UDF: probabilistic_user_id\n",{"type":33,"tag":94,"props":1927,"children":1928},{"class":96,"line":107},[1929,1933,1938,1943],{"type":33,"tag":94,"props":1930,"children":1931},{"style":117},[1932],{"type":38,"value":639},{"type":33,"tag":94,"props":1934,"children":1935},{"style":111},[1936],{"type":38,"value":1937}," TEMP ",{"type":33,"tag":94,"props":1939,"children":1940},{"style":117},[1941],{"type":38,"value":1942},"FUNCTION",{"type":33,"tag":94,"props":1944,"children":1945},{"style":111},[1946],{"type":38,"value":1947}," probabilistic_user_id(ua STRING, ip STRING, tz STRING, res STRING)\n",{"type":33,"tag":94,"props":1949,"children":1950},{"class":96,"line":128},[1951,1956],{"type":33,"tag":94,"props":1952,"children":1953},{"style":117},[1954],{"type":38,"value":1955},"RETURNS",{"type":33,"tag":94,"props":1957,"children":1958},{"style":111},[1959],{"type":38,"value":1960}," STRING\n",{"type":33,"tag":94,"props":1962,"children":1963},{"class":96,"line":159},[1964,1968],{"type":33,"tag":94,"props":1965,"children":1966},{"style":117},[1967],{"type":38,"value":992},{"type":33,"tag":94,"props":1969,"children":1970},{"style":111},[1971],{"type":38,"value":654},{"type":33,"tag":94,"props":1973,"children":1974},{"class":96,"line":226},[1975,1980,1985],{"type":33,"tag":94,"props":1976,"children":1977},{"style":111},[1978],{"type":38,"value":1979},"  TO_BASE64(SHA256(",{"type":33,"tag":94,"props":1981,"children":1982},{"style":137},[1983],{"type":38,"value":1984},"CONCAT",{"type":33,"tag":94,"props":1986,"children":1987},{"style":111},[1988],{"type":38,"value":1989},"(\n",{"type":33,"tag":94,"props":1991,"children":1992},{"class":96,"line":235},[1993,1998,2003,2008],{"type":33,"tag":94,"props":1994,"children":1995},{"style":111},[1996],{"type":38,"value":1997},"    REGEXP_EXTRACT(ua, r",{"type":33,"tag":94,"props":1999,"children":2000},{"style":148},[2001],{"type":38,"value":2002},"'^[^\u002F]+'",{"type":33,"tag":94,"props":2004,"children":2005},{"style":111},[2006],{"type":38,"value":2007},"),  ",{"type":33,"tag":94,"props":2009,"children":2010},{"style":101},[2011],{"type":38,"value":2012},"-- familia del navegador\n",{"type":33,"tag":94,"props":2014,"children":2015},{"class":96,"line":278},[2016,2021,2025,2030,2034,2039,2043,2048,2053,2058,2062],{"type":33,"tag":94,"props":2017,"children":2018},{"style":137},[2019],{"type":38,"value":2020},"    NET",{"type":33,"tag":94,"props":2022,"children":2023},{"style":111},[2024],{"type":38,"value":304},{"type":33,"tag":94,"props":2026,"children":2027},{"style":137},[2028],{"type":38,"value":2029},"IP_TRUNC",{"type":33,"tag":94,"props":2031,"children":2032},{"style":111},[2033],{"type":38,"value":114},{"type":33,"tag":94,"props":2035,"children":2036},{"style":137},[2037],{"type":38,"value":2038},"NET",{"type":33,"tag":94,"props":2040,"children":2041},{"style":111},[2042],{"type":38,"value":304},{"type":33,"tag":94,"props":2044,"children":2045},{"style":137},[2046],{"type":38,"value":2047},"SAFE_IP_FROM_STRING",{"type":33,"tag":94,"props":2049,"children":2050},{"style":111},[2051],{"type":38,"value":2052},"(ip), ",{"type":33,"tag":94,"props":2054,"children":2055},{"style":137},[2056],{"type":38,"value":2057},"24",{"type":33,"tag":94,"props":2059,"children":2060},{"style":111},[2061],{"type":38,"value":2007},{"type":33,"tag":94,"props":2063,"children":2064},{"style":101},[2065],{"type":38,"value":2066},"-- subnet \u002F24\n",{"type":33,"tag":94,"props":2068,"children":2069},{"class":96,"line":317},[2070],{"type":33,"tag":94,"props":2071,"children":2072},{"style":111},[2073],{"type":38,"value":2074},"    tz,\n",{"type":33,"tag":94,"props":2076,"children":2077},{"class":96,"line":27},[2078],{"type":33,"tag":94,"props":2079,"children":2080},{"style":111},[2081],{"type":38,"value":2082},"    res\n",{"type":33,"tag":94,"props":2084,"children":2085},{"class":96,"line":344},[2086],{"type":33,"tag":94,"props":2087,"children":2088},{"style":111},[2089],{"type":38,"value":2090},"  )))\n",{"type":33,"tag":94,"props":2092,"children":2093},{"class":96,"line":353},[2094],{"type":33,"tag":94,"props":2095,"children":2096},{"style":111},[2097],{"type":38,"value":223},{"type":33,"tag":94,"props":2099,"children":2100},{"class":96,"line":362},[2101],{"type":33,"tag":94,"props":2102,"children":2104},{"emptyLinePlaceholder":2103},true,[2105],{"type":38,"value":2106},"\n",{"type":33,"tag":94,"props":2108,"children":2109},{"class":96,"line":371},[2110],{"type":33,"tag":94,"props":2111,"children":2112},{"style":117},[2113],{"type":38,"value":1267},{"type":33,"tag":94,"props":2115,"children":2116},{"class":96,"line":385},[2117,2121],{"type":33,"tag":94,"props":2118,"children":2119},{"style":117},[2120],{"type":38,"value":662},{"type":33,"tag":94,"props":2122,"children":2123},{"style":111},[2124],{"type":38,"value":672},{"type":33,"tag":94,"props":2126,"children":2127},{"class":96,"line":399},[2128],{"type":33,"tag":94,"props":2129,"children":2130},{"style":111},[2131],{"type":38,"value":2132},"  session_hash,\n",{"type":33,"tag":94,"props":2134,"children":2135},{"class":96,"line":408},[2136,2141,2145],{"type":33,"tag":94,"props":2137,"children":2138},{"style":111},[2139],{"type":38,"value":2140},"  probabilistic_user_id(user_agent, ip_address, timezone, screen_resolution) ",{"type":33,"tag":94,"props":2142,"children":2143},{"style":117},[2144],{"type":38,"value":992},{"type":33,"tag":94,"props":2146,"children":2147},{"style":111},[2148],{"type":38,"value":2149}," prob_user_id\n",{"type":33,"tag":94,"props":2151,"children":2152},{"class":96,"line":417},[2153,2157],{"type":33,"tag":94,"props":2154,"children":2155},{"style":117},[2156],{"type":38,"value":1406},{"type":33,"tag":94,"props":2158,"children":2159},{"style":111},[2160],{"type":38,"value":2161}," plausible_events;\n",{"type":33,"tag":34,"props":2163,"children":2164},{},[2165,2167,2176],{"type":38,"value":2166},"Este método no es 100% preciso (diferentes usuarios pueden caer en el mismo hash, tasa de colisión ~2-4%) pero en el marco de ",{"type":33,"tag":2168,"props":2169,"children":2173},"a",{"href":2170,"rel":2171},"https:\u002F\u002Fwww.roibase.com.tr\u002Fes\u002Ffirstparty",[2172],"nofollow",[2174],{"type":38,"value":2175},"Datos de Primera Parte & Arquitectura de Medición",{"type":38,"value":2177}," es posible combinar señales determinísticas (user_id) + probabilísticas (hash) para crear \"cohortes difusas\". En estas cohortes, la tasa de retención muestra menos desviación que los datos modelados de GA4 (en nuestras pruebas A\u002FB promedio 8% desviación vs. 18-22% en GA4 modelado).",{"type":33,"tag":41,"props":2179,"children":2181},{"id":2180},"cumplimiento-kvkk-contrato-de-procesamiento-y-retención-de-logs",[2182],{"type":38,"value":2183},"Cumplimiento KVKK: Contrato de Procesamiento y Retención de Logs",{"type":33,"tag":34,"props":2185,"children":2186},{},[2187,2189,2194,2196,2202],{"type":38,"value":2188},"KVKK Artículo 5: \"Los datos personales deben ser procesados para fines específicos, explícitos y legítimos.\" La combinación IP + user agent se considera \"identificador indirecto\". Plausible recibe la IP en servidor pero ",{"type":33,"tag":77,"props":2190,"children":2191},{},[2192],{"type":38,"value":2193},"no la escribe en ClickHouse",{"type":38,"value":2195}," — solo extrae el campo ",{"type":33,"tag":90,"props":2197,"children":2199},{"className":2198},[],[2200],{"type":38,"value":2201},"country",{"type":38,"value":2203}," mediante búsqueda GeoIP y descarta la IP.",{"type":33,"tag":34,"props":2205,"children":2206},{},[2207],{"type":38,"value":2208},"En instalaciones auto-hospedadas puedes controlar este flujo:",{"type":33,"tag":83,"props":2210,"children":2214},{"className":2211,"code":2212,"language":2213,"meta":17,"style":17},"language-elixir shiki shiki-themes github-dark","# lib\u002Fplausible\u002Fingestion\u002Fevent.ex (simplificado)\ndefmodule Plausible.Ingestion.Event do\n  def process(conn, params) do\n    ip = get_ip_address(conn)\n    country = GeoIP.lookup(ip) |> Map.get(:country_code)\n    \n    event = %{\n      timestamp: DateTime.utc_now(),\n      domain: params[\"d\"],\n      session_hash: params[\"h\"],\n      country: country,\n      # IP se descarta aquí\n    }\n    \n    ClickHouse.insert(\"events\", event)\n  end\nend\n","elixir",[2215],{"type":33,"tag":90,"props":2216,"children":2217},{"__ignoreMap":17},[2218,2226,2234,2242,2250,2258,2266,2274,2282,2290,2298,2306,2314,2321,2328,2336,2344],{"type":33,"tag":94,"props":2219,"children":2220},{"class":96,"line":97},[2221],{"type":33,"tag":94,"props":2222,"children":2223},{},[2224],{"type":38,"value":2225},"# lib\u002Fplausible\u002Fingestion\u002Fevent.ex (simplificado)\n",{"type":33,"tag":94,"props":2227,"children":2228},{"class":96,"line":107},[2229],{"type":33,"tag":94,"props":2230,"children":2231},{},[2232],{"type":38,"value":2233},"defmodule Plausible.Ingestion.Event do\n",{"type":33,"tag":94,"props":2235,"children":2236},{"class":96,"line":128},[2237],{"type":33,"tag":94,"props":2238,"children":2239},{},[2240],{"type":38,"value":2241},"  def process(conn, params) do\n",{"type":33,"tag":94,"props":2243,"children":2244},{"class":96,"line":159},[2245],{"type":33,"tag":94,"props":2246,"children":2247},{},[2248],{"type":38,"value":2249},"    ip = get_ip_address(conn)\n",{"type":33,"tag":94,"props":2251,"children":2252},{"class":96,"line":226},[2253],{"type":33,"tag":94,"props":2254,"children":2255},{},[2256],{"type":38,"value":2257},"    country = GeoIP.lookup(ip) |> Map.get(:country_code)\n",{"type":33,"tag":94,"props":2259,"children":2260},{"class":96,"line":235},[2261],{"type":33,"tag":94,"props":2262,"children":2263},{},[2264],{"type":38,"value":2265},"    \n",{"type":33,"tag":94,"props":2267,"children":2268},{"class":96,"line":278},[2269],{"type":33,"tag":94,"props":2270,"children":2271},{},[2272],{"type":38,"value":2273},"    event = %{\n",{"type":33,"tag":94,"props":2275,"children":2276},{"class":96,"line":317},[2277],{"type":33,"tag":94,"props":2278,"children":2279},{},[2280],{"type":38,"value":2281},"      timestamp: DateTime.utc_now(),\n",{"type":33,"tag":94,"props":2283,"children":2284},{"class":96,"line":27},[2285],{"type":33,"tag":94,"props":2286,"children":2287},{},[2288],{"type":38,"value":2289},"      domain: params[\"d\"],\n",{"type":33,"tag":94,"props":2291,"children":2292},{"class":96,"line":344},[2293],{"type":33,"tag":94,"props":2294,"children":2295},{},[2296],{"type":38,"value":2297},"      session_hash: params[\"h\"],\n",{"type":33,"tag":94,"props":2299,"children":2300},{"class":96,"line":353},[2301],{"type":33,"tag":94,"props":2302,"children":2303},{},[2304],{"type":38,"value":2305},"      country: country,\n",{"type":33,"tag":94,"props":2307,"children":2308},{"class":96,"line":362},[2309],{"type":33,"tag":94,"props":2310,"children":2311},{},[2312],{"type":38,"value":2313},"      # IP se descarta aquí\n",{"type":33,"tag":94,"props":2315,"children":2316},{"class":96,"line":371},[2317],{"type":33,"tag":94,"props":2318,"children":2319},{},[2320],{"type":38,"value":573},{"type":33,"tag":94,"props":2322,"children":2323},{"class":96,"line":385},[2324],{"type":33,"tag":94,"props":2325,"children":2326},{},[2327],{"type":38,"value":2265},{"type":33,"tag":94,"props":2329,"children":2330},{"class":96,"line":399},[2331],{"type":33,"tag":94,"props":2332,"children":2333},{},[2334],{"type":38,"value":2335},"    ClickHouse.insert(\"events\", event)\n",{"type":33,"tag":94,"props":2337,"children":2338},{"class":96,"line":408},[2339],{"type":33,"tag":94,"props":2340,"children":2341},{},[2342],{"type":38,"value":2343},"  end\n",{"type":33,"tag":94,"props":2345,"children":2346},{"class":96,"line":417},[2347],{"type":33,"tag":94,"props":2348,"children":2349},{},[2350],{"type":38,"value":2351},"end\n",{"type":33,"tag":34,"props":2353,"children":2354},{},[2355],{"type":38,"value":2356},"KVKK Artículo 7: \"Puede retenerse el tiempo requerido por el propósito del procesamiento.\" Para analítica típicamente: 24-36 meses. En ClickHouse con TTL basado en particiones:",{"type":33,"tag":83,"props":2358,"children":2360},{"className":625,"code":2359,"language":627,"meta":17,"style":17},"ALTER TABLE events\nMODIFY TTL toDate(timestamp) + INTERVAL 36 MONTH;\n",[2361],{"type":33,"tag":90,"props":2362,"children":2363},{"__ignoreMap":17},[2364,2381],{"type":33,"tag":94,"props":2365,"children":2366},{"class":96,"line":97},[2367,2372,2376],{"type":33,"tag":94,"props":2368,"children":2369},{"style":117},[2370],{"type":38,"value":2371},"ALTER",{"type":33,"tag":94,"props":2373,"children":2374},{"style":117},[2375],{"type":38,"value":644},{"type":33,"tag":94,"props":2377,"children":2378},{"style":111},[2379],{"type":38,"value":2380}," events\n",{"type":33,"tag":94,"props":2382,"children":2383},{"class":96,"line":107},[2384,2389,2394,2398,2402,2406,2411,2416,2421],{"type":33,"tag":94,"props":2385,"children":2386},{"style":117},[2387],{"type":38,"value":2388},"MODIFY",{"type":33,"tag":94,"props":2390,"children":2391},{"style":111},[2392],{"type":38,"value":2393}," TTL toDate(",{"type":33,"tag":94,"props":2395,"children":2396},{"style":117},[2397],{"type":38,"value":840},{"type":33,"tag":94,"props":2399,"children":2400},{"style":111},[2401],{"type":38,"value":499},{"type":33,"tag":94,"props":2403,"children":2404},{"style":117},[2405],{"type":38,"value":189},{"type":33,"tag":94,"props":2407,"children":2408},{"style":111},[2409],{"type":38,"value":2410}," INTERVAL ",{"type":33,"tag":94,"props":2412,"children":2413},{"style":137},[2414],{"type":38,"value":2415},"36",{"type":33,"tag":94,"props":2417,"children":2418},{"style":117},[2419],{"type":38,"value":2420}," MONTH",{"type":33,"tag":94,"props":2422,"children":2423},{"style":111},[2424],{"type":38,"value":156},{"type":33,"tag":34,"props":2426,"children":2427},{},[2428,2430,2436],{"type":38,"value":2429},"Después de 36 meses, la partición se elimina automáticamente. En GA4, los datos a nivel usuario reset después de 14 meses en ",{"type":33,"tag":90,"props":2431,"children":2433},{"className":2432},[],[2434],{"type":38,"value":2435},"user_pseudo_id",{"type":38,"value":2437}," pero la exportación BigQuery de eventos puede retenerse hasta 60 meses (sin embargo, export requiere 360).",{"type":33,"tag":34,"props":2439,"children":2440},{},[2441],{"type":38,"value":2442},"KVKK Contrato de Procesador de Datos: Si usas Plausible Cloud, necesitas firmar un DPA (Data Processing Agreement). Plausible está alojado en EU (Hetzner, Alemania) y proporciona plantilla DPA compatible RGPD. En auto-hospedado, los datos están bajo tu control así que solo eres \"responsable del tratamiento\", no hay \"procesador\".",{"type":33,"tag":41,"props":2444,"children":2446},{"id":2445},"integración-conversion-api-server-side-event-forwarding",[2447],{"type":38,"value":2448},"Integración Conversion API: Server-Side Event Forwarding",{"type":33,"tag":34,"props":2450,"children":2451},{},[2452],{"type":38,"value":2453},"Se pueden enviar eventos de Plausible a Meta\u002FGoogle Ads mediante pipeline de forwarding basado en webhook. Plausible no tiene API propia pero es posible hacer streaming export de ClickHouse a BigQuery e invocar Cloud Function:",{"type":33,"tag":83,"props":2455,"children":2457},{"className":85,"code":2456,"language":87,"meta":17,"style":17},"\u002F\u002F Cloud Function: plausible-to-meta-capi\nconst axios = require('axios');\n\nexports.forwardEvent = async (event, context) => {\n  const pubsubMessage = Buffer.from(event.data, 'base64').toString();\n  const plausibleEvent = JSON.parse(pubsubMessage);\n  \n  if (plausibleEvent.event_name === 'Purchase') {\n    await axios.post('https:\u002F\u002Fgraph.facebook.com\u002Fv18.0\u002F{pixel_id}\u002Fevents', {\n      data: [{\n        event_name: 'Purchase',\n        event_time: Math.floor(plausibleEvent.timestamp \u002F 1000),\n        user_data: {\n          client_ip_address: plausibleEvent.ip_address,  \u002F\u002F hasheado\n          client_user_agent: plausibleEvent.user_agent,\n        },\n        custom_data: {\n          value: plausibleEvent.props.order_value,\n",[2458],{"type":33,"tag":90,"props":2459,"children":2460},{"__ignoreMap":17},[2461,2469,2504,2511,2568,2619,2654,2661,2689,2721,2729,2746,2778,2786,2799,2807,2815,2823],{"type":33,"tag":94,"props":2462,"children":2463},{"class":96,"line":97},[2464],{"type":33,"tag":94,"props":2465,"children":2466},{"style":101},[2467],{"type":38,"value":2468},"\u002F\u002F Cloud Function: plausible-to-meta-capi\n",{"type":33,"tag":94,"props":2470,"children":2471},{"class":96,"line":107},[2472,2477,2482,2486,2491,2495,2500],{"type":33,"tag":94,"props":2473,"children":2474},{"style":117},[2475],{"type":38,"value":2476},"const",{"type":33,"tag":94,"props":2478,"children":2479},{"style":137},[2480],{"type":38,"value":2481}," axios",{"type":33,"tag":94,"props":2483,"children":2484},{"style":117},[2485],{"type":38,"value":145},{"type":33,"tag":94,"props":2487,"children":2488},{"style":176},[2489],{"type":38,"value":2490}," require",{"type":33,"tag":94,"props":2492,"children":2493},{"style":111},[2494],{"type":38,"value":114},{"type":33,"tag":94,"props":2496,"children":2497},{"style":148},[2498],{"type":38,"value":2499},"'axios'",{"type":33,"tag":94,"props":2501,"children":2502},{"style":111},[2503],{"type":38,"value":223},{"type":33,"tag":94,"props":2505,"children":2506},{"class":96,"line":128},[2507],{"type":33,"tag":94,"props":2508,"children":2509},{"emptyLinePlaceholder":2103},[2510],{"type":38,"value":2106},{"type":33,"tag":94,"props":2512,"children":2513},{"class":96,"line":159},[2514,2519,2523,2528,2532,2537,2542,2547,2551,2556,2560,2564],{"type":33,"tag":94,"props":2515,"children":2516},{"style":137},[2517],{"type":38,"value":2518},"exports",{"type":33,"tag":94,"props":2520,"children":2521},{"style":111},[2522],{"type":38,"value":304},{"type":33,"tag":94,"props":2524,"children":2525},{"style":176},[2526],{"type":38,"value":2527},"forwardEvent",{"type":33,"tag":94,"props":2529,"children":2530},{"style":117},[2531],{"type":38,"value":145},{"type":33,"tag":94,"props":2533,"children":2534},{"style":117},[2535],{"type":38,"value":2536}," async",{"type":33,"tag":94,"props":2538,"children":2539},{"style":111},[2540],{"type":38,"value":2541}," (",{"type":33,"tag":94,"props":2543,"children":2544},{"style":253},[2545],{"type":38,"value":2546},"event",{"type":33,"tag":94,"props":2548,"children":2549},{"style":111},[2550],{"type":38,"value":261},{"type":33,"tag":94,"props":2552,"children":2553},{"style":253},[2554],{"type":38,"value":2555},"context",{"type":33,"tag":94,"props":2557,"children":2558},{"style":111},[2559],{"type":38,"value":499},{"type":33,"tag":94,"props":2561,"children":2562},{"style":117},[2563],{"type":38,"value":504},{"type":33,"tag":94,"props":2565,"children":2566},{"style":111},[2567],{"type":38,"value":509},{"type":33,"tag":94,"props":2569,"children":2570},{"class":96,"line":226},[2571,2575,2580,2584,2589,2594,2599,2604,2609,2614],{"type":33,"tag":94,"props":2572,"children":2573},{"style":117},[2574],{"type":38,"value":134},{"type":33,"tag":94,"props":2576,"children":2577},{"style":137},[2578],{"type":38,"value":2579}," pubsubMessage",{"type":33,"tag":94,"props":2581,"children":2582},{"style":117},[2583],{"type":38,"value":145},{"type":33,"tag":94,"props":2585,"children":2586},{"style":111},[2587],{"type":38,"value":2588}," Buffer.",{"type":33,"tag":94,"props":2590,"children":2591},{"style":176},[2592],{"type":38,"value":2593},"from",{"type":33,"tag":94,"props":2595,"children":2596},{"style":111},[2597],{"type":38,"value":2598},"(event.data, ",{"type":33,"tag":94,"props":2600,"children":2601},{"style":148},[2602],{"type":38,"value":2603},"'base64'",{"type":33,"tag":94,"props":2605,"children":2606},{"style":111},[2607],{"type":38,"value":2608},").",{"type":33,"tag":94,"props":2610,"children":2611},{"style":176},[2612],{"type":38,"value":2613},"toString",{"type":33,"tag":94,"props":2615,"children":2616},{"style":111},[2617],{"type":38,"value":2618},"();\n",{"type":33,"tag":94,"props":2620,"children":2621},{"class":96,"line":235},[2622,2626,2631,2635,2640,2644,2649],{"type":33,"tag":94,"props":2623,"children":2624},{"style":117},[2625],{"type":38,"value":134},{"type":33,"tag":94,"props":2627,"children":2628},{"style":137},[2629],{"type":38,"value":2630}," plausibleEvent",{"type":33,"tag":94,"props":2632,"children":2633},{"style":117},[2634],{"type":38,"value":145},{"type":33,"tag":94,"props":2636,"children":2637},{"style":137},[2638],{"type":38,"value":2639}," JSON",{"type":33,"tag":94,"props":2641,"children":2642},{"style":111},[2643],{"type":38,"value":304},{"type":33,"tag":94,"props":2645,"children":2646},{"style":176},[2647],{"type":38,"value":2648},"parse",{"type":33,"tag":94,"props":2650,"children":2651},{"style":111},[2652],{"type":38,"value":2653},"(pubsubMessage);\n",{"type":33,"tag":94,"props":2655,"children":2656},{"class":96,"line":278},[2657],{"type":33,"tag":94,"props":2658,"children":2659},{"style":111},[2660],{"type":38,"value":232},{"type":33,"tag":94,"props":2662,"children":2663},{"class":96,"line":317},[2664,2669,2674,2679,2684],{"type":33,"tag":94,"props":2665,"children":2666},{"style":117},[2667],{"type":38,"value":2668},"  if",{"type":33,"tag":94,"props":2670,"children":2671},{"style":111},[2672],{"type":38,"value":2673}," (plausibleEvent.event_name ",{"type":33,"tag":94,"props":2675,"children":2676},{"style":117},[2677],{"type":38,"value":2678},"===",{"type":33,"tag":94,"props":2680,"children":2681},{"style":148},[2682],{"type":38,"value":2683}," 'Purchase'",{"type":33,"tag":94,"props":2685,"children":2686},{"style":111},[2687],{"type":38,"value":2688},") {\n",{"type":33,"tag":94,"props":2690,"children":2691},{"class":96,"line":27},[2692,2697,2702,2707,2711,2716],{"type":33,"tag":94,"props":2693,"children":2694},{"style":117},[2695],{"type":38,"value":2696},"    await",{"type":33,"tag":94,"props":2698,"children":2699},{"style":111},[2700],{"type":38,"value":2701}," axios.",{"type":33,"tag":94,"props":2703,"children":2704},{"style":176},[2705],{"type":38,"value":2706},"post",{"type":33,"tag":94,"props":2708,"children":2709},{"style":111},[2710],{"type":38,"value":114},{"type":33,"tag":94,"props":2712,"children":2713},{"style":148},[2714],{"type":38,"value":2715},"'https:\u002F\u002Fgraph.facebook.com\u002Fv18.0\u002F{pixel_id}\u002Fevents'",{"type":33,"tag":94,"props":2717,"children":2718},{"style":111},[2719],{"type":38,"value":2720},", {\n",{"type":33,"tag":94,"props":2722,"children":2723},{"class":96,"line":344},[2724],{"type":33,"tag":94,"props":2725,"children":2726},{"style":111},[2727],{"type":38,"value":2728},"      data: [{\n",{"type":33,"tag":94,"props":2730,"children":2731},{"class":96,"line":353},[2732,2737,2742],{"type":33,"tag":94,"props":2733,"children":2734},{"style":111},[2735],{"type":38,"value":2736},"        event_name: ",{"type":33,"tag":94,"props":2738,"children":2739},{"style":148},[2740],{"type":38,"value":2741},"'Purchase'",{"type":33,"tag":94,"props":2743,"children":2744},{"style":111},[2745],{"type":38,"value":672},{"type":33,"tag":94,"props":2747,"children":2748},{"class":96,"line":362},[2749,2754,2759,2764,2769,2774],{"type":33,"tag":94,"props":2750,"children":2751},{"style":111},[2752],{"type":38,"value":2753},"        event_time: Math.",{"type":33,"tag":94,"props":2755,"children":2756},{"style":176},[2757],{"type":38,"value":2758},"floor",{"type":33,"tag":94,"props":2760,"children":2761},{"style":111},[2762],{"type":38,"value":2763},"(plausibleEvent.timestamp ",{"type":33,"tag":94,"props":2765,"children":2766},{"style":117},[2767],{"type":38,"value":2768},"\u002F",{"type":33,"tag":94,"props":2770,"children":2771},{"style":137},[2772],{"type":38,"value":2773}," 1000",{"type":33,"tag":94,"props":2775,"children":2776},{"style":111},[2777],{"type":38,"value":1131},{"type":33,"tag":94,"props":2779,"children":2780},{"class":96,"line":371},[2781],{"type":33,"tag":94,"props":2782,"children":2783},{"style":111},[2784],{"type":38,"value":2785},"        user_data: {\n",{"type":33,"tag":94,"props":2787,"children":2788},{"class":96,"line":385},[2789,2794],{"type":33,"tag":94,"props":2790,"children":2791},{"style":111},[2792],{"type":38,"value":2793},"          client_ip_address: plausibleEvent.ip_address,  ",{"type":33,"tag":94,"props":2795,"children":2796},{"style":101},[2797],{"type":38,"value":2798},"\u002F\u002F hasheado\n",{"type":33,"tag":94,"props":2800,"children":2801},{"class":96,"line":399},[2802],{"type":33,"tag":94,"props":2803,"children":2804},{"style":111},[2805],{"type":38,"value":2806},"          client_user_agent: plausibleEvent.user_agent,\n",{"type":33,"tag":94,"props":2808,"children":2809},{"class":96,"line":408},[2810],{"type":33,"tag":94,"props":2811,"children":2812},{"style":111},[2813],{"type":38,"value":2814},"        },\n",{"type":33,"tag":94,"props":2816,"children":2817},{"class":96,"line":417},[2818],{"type":33,"tag":94,"props":2819,"children":2820},{"style":111},[2821],{"type":38,"value":2822},"        custom_data: {\n",{"type":33,"tag":94,"props":2824,"children":2825},{"class":96,"line":425},[2826],{"type":33,"tag":94,"props":2827,"children":2828},{"style":111},[2829],{"type":38,"value":2830},"          value: plausibleEvent.props.order_value,\n",{"type":33,"tag":2832,"props":2833,"children":2834},"style",{},[2835],{"type":38,"value":2836},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":17,"searchDepth":128,"depth":128,"links":2838},[2839,2840,2841,2842,2843,2844,2845],{"id":43,"depth":107,"text":46},{"id":64,"depth":107,"text":67},{"id":874,"depth":107,"text":877},{"id":1731,"depth":107,"text":1734},{"id":1882,"depth":107,"text":1885},{"id":2180,"depth":107,"text":2183},{"id":2445,"depth":107,"text":2448},"markdown","content:es:data:analitika-centrada-en-privacidad-plausible-agregacion-servidor.md","content","es\u002Fdata\u002Fanalitika-centrada-en-privacidad-plausible-agregacion-servidor.md","es\u002Fdata\u002Fanalitika-centrada-en-privacidad-plausible-agregacion-servidor","md",1785967481729]