[{"data":1,"prerenderedAt":1995},["ShallowReactive",2],{"navigation_docs":3,"-adapters-posthog":181,"-adapters-posthog-surround":1990},[4,30,55,105,122,136],{"title":5,"path":6,"stem":7,"children":8,"page":29},"Getting Started","/getting-started","1.getting-started",[9,14,19,24],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","/getting-started/introduction","1.getting-started/1.introduction","i-lucide-info",{"title":15,"path":16,"stem":17,"icon":18},"Installation","/getting-started/installation","1.getting-started/2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quick Start","/getting-started/quick-start","1.getting-started/3.quick-start","i-lucide-zap",{"title":25,"path":26,"stem":27,"icon":28},"Agent Skills","/getting-started/agent-skills","1.getting-started/4.agent-skills","i-lucide-sparkles",false,{"title":31,"path":32,"stem":33,"children":34,"page":29},"Core Concepts","/core-concepts","2.core-concepts",[35,40,45,50],{"title":36,"path":37,"stem":38,"icon":39},"Wide Events","/core-concepts/wide-events","2.core-concepts/1.wide-events","i-lucide-layers",{"title":41,"path":42,"stem":43,"icon":44},"Structured Errors","/core-concepts/structured-errors","2.core-concepts/2.structured-errors","i-lucide-shield-alert",{"title":46,"path":47,"stem":48,"icon":49},"Best Practices","/core-concepts/best-practices","2.core-concepts/3.best-practices","i-lucide-shield-check",{"title":51,"path":52,"stem":53,"icon":54},"Typed Fields","/core-concepts/typed-fields","2.core-concepts/4.typed-fields","i-simple-icons-typescript",{"title":56,"path":57,"stem":58,"children":59,"page":29},"Adapters","/adapters","3.adapters",[60,65,70,75,80,85,90,95,100],{"title":61,"path":62,"stem":63,"icon":64},"Overview","/adapters/overview","3.adapters/1.overview","i-custom-plug",{"title":66,"path":67,"stem":68,"icon":69},"Axiom","/adapters/axiom","3.adapters/2.axiom","i-custom-axiom",{"title":71,"path":72,"stem":73,"icon":74},"OTLP","/adapters/otlp","3.adapters/3.otlp","i-simple-icons-opentelemetry",{"title":76,"path":77,"stem":78,"icon":79},"PostHog","/adapters/posthog","3.adapters/4.posthog","i-simple-icons-posthog",{"title":81,"path":82,"stem":83,"icon":84},"Sentry","/adapters/sentry","3.adapters/5.sentry","i-simple-icons-sentry",{"title":86,"path":87,"stem":88,"icon":89},"Better Stack","/adapters/better-stack","3.adapters/6.better-stack","i-simple-icons-betterstack",{"title":91,"path":92,"stem":93,"icon":94},"Custom Adapters","/adapters/custom","3.adapters/7.custom","i-lucide-code",{"title":96,"path":97,"stem":98,"icon":99},"Pipeline","/adapters/pipeline","3.adapters/8.pipeline","i-lucide-workflow",{"title":101,"path":102,"stem":103,"icon":104},"Browser","/adapters/browser","3.adapters/9.browser","i-lucide-globe",{"title":106,"path":107,"stem":108,"children":109,"page":29},"Enrichers","/enrichers","4.enrichers",[110,113,118],{"title":61,"path":111,"stem":112,"icon":28},"/enrichers/overview","4.enrichers/1.overview",{"title":114,"path":115,"stem":116,"icon":117},"Built-in","/enrichers/built-in","4.enrichers/2.built-in","i-lucide-puzzle",{"title":119,"path":120,"stem":121,"icon":94},"Custom","/enrichers/custom","4.enrichers/3.custom",{"title":123,"path":124,"stem":125,"children":126,"page":29},"NuxtHub","/nuxthub","5.nuxthub",[127,131],{"title":61,"path":128,"stem":129,"icon":130},"/nuxthub/overview","5.nuxthub/1.overview","i-lucide-database",{"title":132,"path":133,"stem":134,"icon":135},"Retention","/nuxthub/retention","5.nuxthub/2.retention","i-lucide-clock",{"title":137,"path":138,"stem":139,"children":140,"page":29},"Examples","/examples","6.examples",[141,146,151,156,161,166,171,176],{"title":142,"path":143,"stem":144,"icon":145},"Next.js","/examples/nextjs","6.examples/1.nextjs","i-simple-icons-nextdotjs",{"title":147,"path":148,"stem":149,"icon":150},"SvelteKit","/examples/sveltekit","6.examples/2.sveltekit","i-simple-icons-svelte",{"title":152,"path":153,"stem":154,"icon":155},"TanStack Start","/examples/tanstack-start","6.examples/3.tanstack-start","i-custom-tanstack",{"title":157,"path":158,"stem":159,"icon":160},"NestJS","/examples/nestjs","6.examples/4.nestjs","i-simple-icons-nestjs",{"title":162,"path":163,"stem":164,"icon":165},"Express","/examples/express","6.examples/5.express","i-simple-icons-express",{"title":167,"path":168,"stem":169,"icon":170},"Hono","/examples/hono","6.examples/6.hono","i-simple-icons-hono",{"title":172,"path":173,"stem":174,"icon":175},"Fastify","/examples/fastify","6.examples/7.fastify","i-simple-icons-fastify",{"title":177,"path":178,"stem":179,"icon":180},"Elysia","/examples/elysia","6.examples/8.elysia","i-custom-elysia",{"id":182,"title":183,"body":184,"description":1976,"extension":1977,"links":1978,"meta":1986,"navigation":1987,"path":77,"seo":1988,"stem":78,"__hash__":1989},"docs/3.adapters/4.posthog.md","PostHog Adapter",{"type":185,"value":186,"toc":1946},"minimark",[187,203,207,210,254,257,262,295,299,318,322,428,431,435,438,478,482,523,534,538,545,632,636,639,758,762,838,842,852,884,888,894,934,962,966,973,986,990,996,1116,1124,1128,1232,1236,1239,1327,1331,1337,1363,1367,1442,1445,1554,1558,1562,1570,1573,1577,1580,1600,1604,1610,1623,1627,1630,1750,1753,1914,1918,1942],[188,189,190,196,197,202],"p",{},[191,192,76],"a",{"href":193,"rel":194},"https://posthog.com",[195],"nofollow"," is an open-source product analytics platform. The evlog PostHog adapter sends your wide events to ",[191,198,201],{"href":199,"rel":200},"https://posthog.com/docs/logs",[195],"PostHog Logs"," via the standard OTLP format, giving you a dedicated log viewer with filtering, search, and tail mode — all using your existing PostHog API key.",[204,205,15],"h2",{"id":206},"installation",[188,208,209],{},"The PostHog adapter comes bundled with evlog:",[211,212,218],"pre",{"className":213,"code":214,"filename":215,"language":216,"meta":217,"style":217},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createPostHogDrain } from 'evlog/posthog'\n","server/plugins/evlog-drain.ts","typescript","",[219,220,221],"code",{"__ignoreMap":217},[222,223,226,230,234,238,241,244,247,251],"span",{"class":224,"line":225},"line",1,[222,227,229],{"class":228},"s7zQu","import",[222,231,233],{"class":232},"sMK4o"," {",[222,235,237],{"class":236},"sTEyZ"," createPostHogDrain",[222,239,240],{"class":232}," }",[222,242,243],{"class":228}," from",[222,245,246],{"class":232}," '",[222,248,250],{"class":249},"sfazB","evlog/posthog",[222,252,253],{"class":232},"'\n",[204,255,20],{"id":256},"quick-start",[258,259,261],"h3",{"id":260},"_1-get-your-posthog-project-api-key","1. Get your PostHog project API key",[263,264,265,274,288],"ol",{},[266,267,268,269],"li",{},"Log in to your ",[191,270,273],{"href":271,"rel":272},"https://app.posthog.com",[195],"PostHog dashboard",[266,275,276,277,281,282,281,285],{},"Go to ",[278,279,280],"strong",{},"Settings"," > ",[278,283,284],{},"Project",[278,286,287],{},"Project API Key",[266,289,290,291,294],{},"Copy the key (starts with ",[219,292,293],{},"phc_",")",[258,296,298],{"id":297},"_2-set-environment-variables","2. Set environment variables",[211,300,305],{"className":301,"code":302,"filename":303,"language":304,"meta":217,"style":217},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","NUXT_POSTHOG_API_KEY=phc_your-project-api-key\n",".env","bash",[219,306,307],{"__ignoreMap":217},[222,308,309,312,315],{"class":224,"line":225},[222,310,311],{"class":236},"NUXT_POSTHOG_API_KEY",[222,313,314],{"class":232},"=",[222,316,317],{"class":249},"phc_your-project-api-key\n",[258,319,321],{"id":320},"_3-create-the-drain-plugin","3. Create the drain plugin",[211,323,325],{"className":213,"code":324,"filename":215,"language":216,"meta":217,"style":217},"import { createPostHogDrain } from 'evlog/posthog'\n\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', createPostHogDrain())\n})\n",[219,326,327,345,352,383,419],{"__ignoreMap":217},[222,328,329,331,333,335,337,339,341,343],{"class":224,"line":225},[222,330,229],{"class":228},[222,332,233],{"class":232},[222,334,237],{"class":236},[222,336,240],{"class":232},[222,338,243],{"class":228},[222,340,246],{"class":232},[222,342,250],{"class":249},[222,344,253],{"class":232},[222,346,348],{"class":224,"line":347},2,[222,349,351],{"emptyLinePlaceholder":350},true,"\n",[222,353,355,358,361,365,368,370,374,376,380],{"class":224,"line":354},3,[222,356,357],{"class":228},"export",[222,359,360],{"class":228}," default",[222,362,364],{"class":363},"s2Zo4"," defineNitroPlugin",[222,366,367],{"class":236},"(",[222,369,367],{"class":232},[222,371,373],{"class":372},"sHdIc","nitroApp",[222,375,294],{"class":232},[222,377,379],{"class":378},"spNyl"," =>",[222,381,382],{"class":232}," {\n",[222,384,386,389,392,395,397,400,403,406,409,411,414,416],{"class":224,"line":385},4,[222,387,388],{"class":236},"  nitroApp",[222,390,391],{"class":232},".",[222,393,394],{"class":236},"hooks",[222,396,391],{"class":232},[222,398,399],{"class":363},"hook",[222,401,367],{"class":402},"swJcz",[222,404,405],{"class":232},"'",[222,407,408],{"class":249},"evlog:drain",[222,410,405],{"class":232},[222,412,413],{"class":232},",",[222,415,237],{"class":363},[222,417,418],{"class":402},"())\n",[222,420,422,425],{"class":224,"line":421},5,[222,423,424],{"class":232},"}",[222,426,427],{"class":236},")\n",[188,429,430],{},"That's it! Your wide events will now appear in PostHog Logs with full OTLP structure including severity levels, trace context, and structured attributes.",[204,432,434],{"id":433},"configuration","Configuration",[188,436,437],{},"The adapter reads configuration from multiple sources (highest priority first):",[263,439,440,449,458,465],{},[266,441,442,445,446],{},[278,443,444],{},"Overrides"," passed to ",[219,447,448],{},"createPostHogDrain()",[266,450,451,454,455],{},[278,452,453],{},"Runtime config"," at ",[219,456,457],{},"runtimeConfig.evlog.posthog",[266,459,460,454,462],{},[278,461,453],{},[219,463,464],{},"runtimeConfig.posthog",[266,466,467,470,471,474,475,294],{},[278,468,469],{},"Environment variables"," (",[219,472,473],{},"NUXT_POSTHOG_*"," or ",[219,476,477],{},"POSTHOG_*",[258,479,481],{"id":480},"environment-variables","Environment Variables",[483,484,485,498],"table",{},[486,487,488],"thead",{},[489,490,491,495],"tr",{},[492,493,494],"th",{},"Variable",[492,496,497],{},"Description",[499,500,501,513],"tbody",{},[489,502,503,508],{},[504,505,506],"td",{},[219,507,311],{},[504,509,510,511,294],{},"Project API key (starts with ",[219,512,293],{},[489,514,515,520],{},[504,516,517],{},[219,518,519],{},"NUXT_POSTHOG_HOST",[504,521,522],{},"PostHog host URL (for EU or self-hosted)",[188,524,525,526,529,530,533],{},"You can also use ",[219,527,528],{},"POSTHOG_API_KEY"," and ",[219,531,532],{},"POSTHOG_HOST"," as fallbacks.",[258,535,537],{"id":536},"runtime-config","Runtime Config",[188,539,540,541,544],{},"Configure via ",[219,542,543],{},"nuxt.config.ts"," for type-safe configuration:",[211,546,548],{"className":213,"code":547,"filename":543,"language":216,"meta":217,"style":217},"export default defineNuxtConfig({\n  runtimeConfig: {\n    posthog: {\n      apiKey: '', // Set via NUXT_POSTHOG_API_KEY\n      host: '', // Set via NUXT_POSTHOG_HOST\n    },\n  },\n})\n",[219,549,550,564,574,583,599,613,619,625],{"__ignoreMap":217},[222,551,552,554,556,559,561],{"class":224,"line":225},[222,553,357],{"class":228},[222,555,360],{"class":228},[222,557,558],{"class":363}," defineNuxtConfig",[222,560,367],{"class":236},[222,562,563],{"class":232},"{\n",[222,565,566,569,572],{"class":224,"line":347},[222,567,568],{"class":402},"  runtimeConfig",[222,570,571],{"class":232},":",[222,573,382],{"class":232},[222,575,576,579,581],{"class":224,"line":354},[222,577,578],{"class":402},"    posthog",[222,580,571],{"class":232},[222,582,382],{"class":232},[222,584,585,588,590,593,595],{"class":224,"line":385},[222,586,587],{"class":402},"      apiKey",[222,589,571],{"class":232},[222,591,592],{"class":232}," ''",[222,594,413],{"class":232},[222,596,598],{"class":597},"sHwdD"," // Set via NUXT_POSTHOG_API_KEY\n",[222,600,601,604,606,608,610],{"class":224,"line":421},[222,602,603],{"class":402},"      host",[222,605,571],{"class":232},[222,607,592],{"class":232},[222,609,413],{"class":232},[222,611,612],{"class":597}," // Set via NUXT_POSTHOG_HOST\n",[222,614,616],{"class":224,"line":615},6,[222,617,618],{"class":232},"    },\n",[222,620,622],{"class":224,"line":621},7,[222,623,624],{"class":232},"  },\n",[222,626,628,630],{"class":224,"line":627},8,[222,629,424],{"class":232},[222,631,427],{"class":236},[258,633,635],{"id":634},"override-options","Override Options",[188,637,638],{},"Pass options directly to override any configuration:",[211,640,642],{"className":213,"code":641,"filename":215,"language":216,"meta":217,"style":217},"import { createPostHogDrain } from 'evlog/posthog'\n\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', createPostHogDrain({\n    host: 'https://eu.i.posthog.com',\n    timeout: 10000,\n  }))\n})\n",[219,643,644,662,666,686,714,731,744,752],{"__ignoreMap":217},[222,645,646,648,650,652,654,656,658,660],{"class":224,"line":225},[222,647,229],{"class":228},[222,649,233],{"class":232},[222,651,237],{"class":236},[222,653,240],{"class":232},[222,655,243],{"class":228},[222,657,246],{"class":232},[222,659,250],{"class":249},[222,661,253],{"class":232},[222,663,664],{"class":224,"line":347},[222,665,351],{"emptyLinePlaceholder":350},[222,667,668,670,672,674,676,678,680,682,684],{"class":224,"line":354},[222,669,357],{"class":228},[222,671,360],{"class":228},[222,673,364],{"class":363},[222,675,367],{"class":236},[222,677,367],{"class":232},[222,679,373],{"class":372},[222,681,294],{"class":232},[222,683,379],{"class":378},[222,685,382],{"class":232},[222,687,688,690,692,694,696,698,700,702,704,706,708,710,712],{"class":224,"line":385},[222,689,388],{"class":236},[222,691,391],{"class":232},[222,693,394],{"class":236},[222,695,391],{"class":232},[222,697,399],{"class":363},[222,699,367],{"class":402},[222,701,405],{"class":232},[222,703,408],{"class":249},[222,705,405],{"class":232},[222,707,413],{"class":232},[222,709,237],{"class":363},[222,711,367],{"class":402},[222,713,563],{"class":232},[222,715,716,719,721,723,726,728],{"class":224,"line":421},[222,717,718],{"class":402},"    host",[222,720,571],{"class":232},[222,722,246],{"class":232},[222,724,725],{"class":249},"https://eu.i.posthog.com",[222,727,405],{"class":232},[222,729,730],{"class":232},",\n",[222,732,733,736,738,742],{"class":224,"line":615},[222,734,735],{"class":402},"    timeout",[222,737,571],{"class":232},[222,739,741],{"class":740},"sbssI"," 10000",[222,743,730],{"class":232},[222,745,746,749],{"class":224,"line":621},[222,747,748],{"class":232},"  }",[222,750,751],{"class":402},"))\n",[222,753,754,756],{"class":224,"line":627},[222,755,424],{"class":232},[222,757,427],{"class":236},[258,759,761],{"id":760},"full-configuration-reference","Full Configuration Reference",[483,763,764,779],{},[486,765,766],{},[489,767,768,771,774,777],{},[492,769,770],{},"Option",[492,772,773],{},"Type",[492,775,776],{},"Default",[492,778,497],{},[499,780,781,799,818],{},[489,782,783,788,793,796],{},[504,784,785],{},[219,786,787],{},"apiKey",[504,789,790],{},[219,791,792],{},"string",[504,794,795],{},"-",[504,797,798],{},"Project API key (required)",[489,800,801,806,810,815],{},[504,802,803],{},[219,804,805],{},"host",[504,807,808],{},[219,809,792],{},[504,811,812],{},[219,813,814],{},"https://us.i.posthog.com",[504,816,817],{},"PostHog host URL",[489,819,820,825,830,835],{},[504,821,822],{},[219,823,824],{},"timeout",[504,826,827],{},[219,828,829],{},"number",[504,831,832],{},[219,833,834],{},"5000",[504,836,837],{},"Request timeout in milliseconds",[204,839,841],{"id":840},"how-it-works","How It Works",[188,843,844,845,847,848,851],{},"Under the hood, ",[219,846,448],{}," wraps the OTLP adapter's ",[219,849,850],{},"sendBatchToOTLP()"," with PostHog-specific defaults:",[853,854,855,865,874],"ul",{},[266,856,857,860,861,864],{},[278,858,859],{},"Endpoint",": ",[219,862,863],{},"{host}/i/v1/logs"," (PostHog's OTLP log ingest endpoint)",[266,866,867,860,870,873],{},[278,868,869],{},"Auth",[219,871,872],{},"Authorization: Bearer {apiKey}"," header",[266,875,876,879,880,883],{},[278,877,878],{},"Format",": Standard OTLP ",[219,881,882],{},"ExportLogsServiceRequest"," with severity levels, trace context, and structured attributes",[204,885,887],{"id":886},"regions","Regions",[188,889,890,891,893],{},"PostHog offers US and EU cloud hosting. Set the ",[219,892,805],{}," to match your region:",[483,895,896,906],{},[486,897,898],{},[489,899,900,903],{},[492,901,902],{},"Region",[492,904,905],{},"Host",[499,907,908,917,926],{},[489,909,910,913],{},[504,911,912],{},"US (default)",[504,914,915],{},[219,916,814],{},[489,918,919,922],{},[504,920,921],{},"EU",[504,923,924],{},[219,925,725],{},[489,927,928,931],{},[504,929,930],{},"Self-hosted",[504,932,933],{},"Your instance URL",[211,935,937],{"className":301,"code":936,"filename":303,"language":304,"meta":217,"style":217},"# EU region\nNUXT_POSTHOG_API_KEY=phc_xxx\nNUXT_POSTHOG_HOST=https://eu.i.posthog.com\n",[219,938,939,944,953],{"__ignoreMap":217},[222,940,941],{"class":224,"line":225},[222,942,943],{"class":597},"# EU region\n",[222,945,946,948,950],{"class":224,"line":347},[222,947,311],{"class":236},[222,949,314],{"class":232},[222,951,952],{"class":249},"phc_xxx\n",[222,954,955,957,959],{"class":224,"line":354},[222,956,519],{"class":236},[222,958,314],{"class":232},[222,960,961],{"class":249},"https://eu.i.posthog.com\n",[204,963,965],{"id":964},"querying-logs-in-posthog","Querying Logs in PostHog",[188,967,968,969,972],{},"Once your logs are flowing, use the ",[278,970,971],{},"Logs"," tab in PostHog to query them:",[263,974,975,980,983],{},[266,976,276,977,979],{},[278,978,971],{}," and filter by service, severity, or any structured attribute",[266,981,982],{},"Use the search bar to find specific log entries",[266,984,985],{},"Click on a log entry to see all structured attributes",[204,987,989],{"id":988},"posthog-events-custom-events","PostHog Events (Custom Events)",[188,991,992,993,571],{},"If you prefer sending logs as PostHog custom events (e.g., for product analytics, cohorts, or funnels), use ",[219,994,995],{},"createPostHogEventsDrain()",[211,997,999],{"className":213,"code":998,"filename":215,"language":216,"meta":217,"style":217},"import { createPostHogEventsDrain } from 'evlog/posthog'\n\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', createPostHogEventsDrain({\n    eventName: 'server_request',\n    distinctId: 'my-backend-service',\n  }))\n})\n",[219,1000,1001,1020,1024,1044,1072,1088,1104,1110],{"__ignoreMap":217},[222,1002,1003,1005,1007,1010,1012,1014,1016,1018],{"class":224,"line":225},[222,1004,229],{"class":228},[222,1006,233],{"class":232},[222,1008,1009],{"class":236}," createPostHogEventsDrain",[222,1011,240],{"class":232},[222,1013,243],{"class":228},[222,1015,246],{"class":232},[222,1017,250],{"class":249},[222,1019,253],{"class":232},[222,1021,1022],{"class":224,"line":347},[222,1023,351],{"emptyLinePlaceholder":350},[222,1025,1026,1028,1030,1032,1034,1036,1038,1040,1042],{"class":224,"line":354},[222,1027,357],{"class":228},[222,1029,360],{"class":228},[222,1031,364],{"class":363},[222,1033,367],{"class":236},[222,1035,367],{"class":232},[222,1037,373],{"class":372},[222,1039,294],{"class":232},[222,1041,379],{"class":378},[222,1043,382],{"class":232},[222,1045,1046,1048,1050,1052,1054,1056,1058,1060,1062,1064,1066,1068,1070],{"class":224,"line":385},[222,1047,388],{"class":236},[222,1049,391],{"class":232},[222,1051,394],{"class":236},[222,1053,391],{"class":232},[222,1055,399],{"class":363},[222,1057,367],{"class":402},[222,1059,405],{"class":232},[222,1061,408],{"class":249},[222,1063,405],{"class":232},[222,1065,413],{"class":232},[222,1067,1009],{"class":363},[222,1069,367],{"class":402},[222,1071,563],{"class":232},[222,1073,1074,1077,1079,1081,1084,1086],{"class":224,"line":421},[222,1075,1076],{"class":402},"    eventName",[222,1078,571],{"class":232},[222,1080,246],{"class":232},[222,1082,1083],{"class":249},"server_request",[222,1085,405],{"class":232},[222,1087,730],{"class":232},[222,1089,1090,1093,1095,1097,1100,1102],{"class":224,"line":615},[222,1091,1092],{"class":402},"    distinctId",[222,1094,571],{"class":232},[222,1096,246],{"class":232},[222,1098,1099],{"class":249},"my-backend-service",[222,1101,405],{"class":232},[222,1103,730],{"class":232},[222,1105,1106,1108],{"class":224,"line":621},[222,1107,748],{"class":232},[222,1109,751],{"class":402},[222,1111,1112,1114],{"class":224,"line":627},[222,1113,424],{"class":232},[222,1115,427],{"class":236},[1117,1118,1120,1121,1123],"callout",{"color":1119,"icon":13},"info","Custom events count towards your PostHog event quota. PostHog Logs (the default ",[219,1122,448],{},") is significantly cheaper.",[258,1125,1127],{"id":1126},"events-configuration","Events Configuration",[483,1129,1130,1142],{},[486,1131,1132],{},[489,1133,1134,1136,1138,1140],{},[492,1135,770],{},[492,1137,773],{},[492,1139,776],{},[492,1141,497],{},[499,1143,1144,1158,1174,1193,1216],{},[489,1145,1146,1150,1154,1156],{},[504,1147,1148],{},[219,1149,787],{},[504,1151,1152],{},[219,1153,792],{},[504,1155,795],{},[504,1157,798],{},[489,1159,1160,1164,1168,1172],{},[504,1161,1162],{},[219,1163,805],{},[504,1165,1166],{},[219,1167,792],{},[504,1169,1170],{},[219,1171,814],{},[504,1173,817],{},[489,1175,1176,1181,1185,1190],{},[504,1177,1178],{},[219,1179,1180],{},"eventName",[504,1182,1183],{},[219,1184,792],{},[504,1186,1187],{},[219,1188,1189],{},"evlog_wide_event",[504,1191,1192],{},"PostHog event name",[489,1194,1195,1200,1204,1209],{},[504,1196,1197],{},[219,1198,1199],{},"distinctId",[504,1201,1202],{},[219,1203,792],{},[504,1205,1206],{},[219,1207,1208],{},"event.service",[504,1210,1211,1212,1215],{},"Override ",[219,1213,1214],{},"distinct_id"," for all events",[489,1217,1218,1222,1226,1230],{},[504,1219,1220],{},[219,1221,824],{},[504,1223,1224],{},[219,1225,829],{},[504,1227,1228],{},[219,1229,834],{},[504,1231,837],{},[258,1233,1235],{"id":1234},"event-format","Event Format",[188,1237,1238],{},"evlog maps wide events to PostHog events:",[483,1240,1241,1251],{},[486,1242,1243],{},[489,1244,1245,1248],{},[492,1246,1247],{},"evlog Field",[492,1249,1250],{},"PostHog Field",[499,1252,1253,1271,1282,1294,1305,1317],{},[489,1254,1255,1266],{},[504,1256,1257,474,1260,474,1263],{},[219,1258,1259],{},"config.distinctId",[219,1261,1262],{},"userId",[219,1264,1265],{},"service",[504,1267,1268,1270],{},[219,1269,1214],{}," (fallback chain)",[489,1272,1273,1278],{},[504,1274,1275],{},[219,1276,1277],{},"timestamp",[504,1279,1280],{},[219,1281,1277],{},[489,1283,1284,1289],{},[504,1285,1286],{},[219,1287,1288],{},"level",[504,1290,1291],{},[219,1292,1293],{},"properties.level",[489,1295,1296,1300],{},[504,1297,1298],{},[219,1299,1265],{},[504,1301,1302],{},[219,1303,1304],{},"properties.service",[489,1306,1307,1312],{},[504,1308,1309],{},[219,1310,1311],{},"environment",[504,1313,1314],{},[219,1315,1316],{},"properties.environment",[489,1318,1319,1322],{},[504,1320,1321],{},"All other fields",[504,1323,1324],{},[219,1325,1326],{},"properties.*",[258,1328,1330],{"id":1329},"distinct-id-resolution","Distinct ID Resolution",[188,1332,1333,1334,1336],{},"The ",[219,1335,1214],{}," follows a fallback chain:",[263,1338,1339,1348,1356],{},[266,1340,1341,1345,1346],{},[278,1342,1343],{},[219,1344,1259],{}," — explicit override in ",[219,1347,995],{},[266,1349,1350,1355],{},[278,1351,1352],{},[219,1353,1354],{},"event.userId"," — automatically picked up if present as a string",[266,1357,1358,1362],{},[278,1359,1360],{},[219,1361,1208],{}," — final fallback",[258,1364,1366],{"id":1365},"logs-vs-events","Logs vs Events",[483,1368,1369,1383],{},[486,1370,1371],{},[489,1372,1373,1375,1379],{},[492,1374],{},[492,1376,1377],{},[219,1378,448],{},[492,1380,1381],{},[219,1382,995],{},[499,1384,1385,1403,1416,1429],{},[489,1386,1387,1391,1397],{},[504,1388,1389],{},[278,1390,878],{},[504,1392,1393,1394,294],{},"OTLP Logs (",[219,1395,1396],{},"/i/v1/logs",[504,1398,1399,1400,294],{},"PostHog Events (",[219,1401,1402],{},"/batch/",[489,1404,1405,1410,1413],{},[504,1406,1407],{},[278,1408,1409],{},"PostHog UI",[504,1411,1412],{},"Logs viewer",[504,1414,1415],{},"Events explorer",[489,1417,1418,1423,1426],{},[504,1419,1420],{},[278,1421,1422],{},"Cost",[504,1424,1425],{},"Lower (dedicated logs pipeline)",[504,1427,1428],{},"Higher (counts as events)",[489,1430,1431,1436,1439],{},[504,1432,1433],{},[278,1434,1435],{},"Best for",[504,1437,1438],{},"Debugging, log search, observability",[504,1440,1441],{},"Product analytics, cohorts, funnels",[188,1443,1444],{},"You can use both drains simultaneously to get the best of both worlds:",[211,1446,1448],{"className":213,"code":1447,"filename":215,"language":216,"meta":217,"style":217},"import { createPostHogDrain, createPostHogEventsDrain } from 'evlog/posthog'\n\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', createPostHogDrain())\n  nitroApp.hooks.hook('evlog:drain', createPostHogEventsDrain())\n})\n",[219,1449,1450,1472,1476,1496,1522,1548],{"__ignoreMap":217},[222,1451,1452,1454,1456,1458,1460,1462,1464,1466,1468,1470],{"class":224,"line":225},[222,1453,229],{"class":228},[222,1455,233],{"class":232},[222,1457,237],{"class":236},[222,1459,413],{"class":232},[222,1461,1009],{"class":236},[222,1463,240],{"class":232},[222,1465,243],{"class":228},[222,1467,246],{"class":232},[222,1469,250],{"class":249},[222,1471,253],{"class":232},[222,1473,1474],{"class":224,"line":347},[222,1475,351],{"emptyLinePlaceholder":350},[222,1477,1478,1480,1482,1484,1486,1488,1490,1492,1494],{"class":224,"line":354},[222,1479,357],{"class":228},[222,1481,360],{"class":228},[222,1483,364],{"class":363},[222,1485,367],{"class":236},[222,1487,367],{"class":232},[222,1489,373],{"class":372},[222,1491,294],{"class":232},[222,1493,379],{"class":378},[222,1495,382],{"class":232},[222,1497,1498,1500,1502,1504,1506,1508,1510,1512,1514,1516,1518,1520],{"class":224,"line":385},[222,1499,388],{"class":236},[222,1501,391],{"class":232},[222,1503,394],{"class":236},[222,1505,391],{"class":232},[222,1507,399],{"class":363},[222,1509,367],{"class":402},[222,1511,405],{"class":232},[222,1513,408],{"class":249},[222,1515,405],{"class":232},[222,1517,413],{"class":232},[222,1519,237],{"class":363},[222,1521,418],{"class":402},[222,1523,1524,1526,1528,1530,1532,1534,1536,1538,1540,1542,1544,1546],{"class":224,"line":421},[222,1525,388],{"class":236},[222,1527,391],{"class":232},[222,1529,394],{"class":236},[222,1531,391],{"class":232},[222,1533,399],{"class":363},[222,1535,367],{"class":402},[222,1537,405],{"class":232},[222,1539,408],{"class":249},[222,1541,405],{"class":232},[222,1543,413],{"class":232},[222,1545,1009],{"class":363},[222,1547,418],{"class":402},[222,1549,1550,1552],{"class":224,"line":615},[222,1551,424],{"class":232},[222,1553,427],{"class":236},[204,1555,1557],{"id":1556},"troubleshooting","Troubleshooting",[258,1559,1561],{"id":1560},"missing-apikey-error","Missing apiKey error",[211,1563,1568],{"className":1564,"code":1566,"language":1567},[1565],"language-text","[evlog/posthog] Missing apiKey. Set NUXT_POSTHOG_API_KEY/POSTHOG_API_KEY env var or pass to createPostHogDrain()\n","text",[219,1569,1566],{"__ignoreMap":217},[188,1571,1572],{},"Make sure your environment variable is set and the server was restarted after adding it.",[258,1574,1576],{"id":1575},"events-not-appearing","Events not appearing",[188,1578,1579],{},"PostHog processes events asynchronously. There may be a short delay (typically under 1 minute) before events appear in the dashboard.",[263,1581,1582,1589,1594],{},[266,1583,1584,1585,1588],{},"Check the server console for ",[219,1586,1587],{},"[evlog/posthog]"," error messages",[266,1590,1591,1592],{},"Verify your API key is correct and starts with ",[219,1593,293],{},[266,1595,1596,1597,1599],{},"Confirm your ",[219,1598,805],{}," matches your PostHog region (US vs EU)",[258,1601,1603],{"id":1602},"wrong-region","Wrong region",[188,1605,1606,1607,1609],{},"If you're on PostHog EU but using the default US host, event delivery will fail and the adapter will log errors (for example under ",[219,1608,1587],{},") to your server console. Set the correct host:",[211,1611,1613],{"className":301,"code":1612,"filename":303,"language":304,"meta":217,"style":217},"NUXT_POSTHOG_HOST=https://eu.i.posthog.com\n",[219,1614,1615],{"__ignoreMap":217},[222,1616,1617,1619,1621],{"class":224,"line":225},[222,1618,519],{"class":236},[222,1620,314],{"class":232},[222,1622,961],{"class":249},[204,1624,1626],{"id":1625},"direct-api-usage","Direct API Usage",[188,1628,1629],{},"For advanced use cases, you can use the lower-level functions:",[211,1631,1634],{"className":213,"code":1632,"filename":1633,"language":216,"meta":217,"style":217},"import { sendToPostHog, sendBatchToPostHog } from 'evlog/posthog'\n\n// Send a single event to PostHog Logs (OTLP)\nawait sendToPostHog(event, {\n  apiKey: 'phc_xxx',\n})\n\n// Send multiple events in one request\nawait sendBatchToPostHog(events, {\n  apiKey: 'phc_xxx',\n})\n","server/utils/posthog.ts",[219,1635,1636,1660,1664,1669,1683,1699,1705,1709,1714,1728,1743],{"__ignoreMap":217},[222,1637,1638,1640,1642,1645,1647,1650,1652,1654,1656,1658],{"class":224,"line":225},[222,1639,229],{"class":228},[222,1641,233],{"class":232},[222,1643,1644],{"class":236}," sendToPostHog",[222,1646,413],{"class":232},[222,1648,1649],{"class":236}," sendBatchToPostHog",[222,1651,240],{"class":232},[222,1653,243],{"class":228},[222,1655,246],{"class":232},[222,1657,250],{"class":249},[222,1659,253],{"class":232},[222,1661,1662],{"class":224,"line":347},[222,1663,351],{"emptyLinePlaceholder":350},[222,1665,1666],{"class":224,"line":354},[222,1667,1668],{"class":597},"// Send a single event to PostHog Logs (OTLP)\n",[222,1670,1671,1674,1676,1679,1681],{"class":224,"line":385},[222,1672,1673],{"class":228},"await",[222,1675,1644],{"class":363},[222,1677,1678],{"class":236},"(event",[222,1680,413],{"class":232},[222,1682,382],{"class":232},[222,1684,1685,1688,1690,1692,1695,1697],{"class":224,"line":421},[222,1686,1687],{"class":402},"  apiKey",[222,1689,571],{"class":232},[222,1691,246],{"class":232},[222,1693,1694],{"class":249},"phc_xxx",[222,1696,405],{"class":232},[222,1698,730],{"class":232},[222,1700,1701,1703],{"class":224,"line":615},[222,1702,424],{"class":232},[222,1704,427],{"class":236},[222,1706,1707],{"class":224,"line":621},[222,1708,351],{"emptyLinePlaceholder":350},[222,1710,1711],{"class":224,"line":627},[222,1712,1713],{"class":597},"// Send multiple events in one request\n",[222,1715,1717,1719,1721,1724,1726],{"class":224,"line":1716},9,[222,1718,1673],{"class":228},[222,1720,1649],{"class":363},[222,1722,1723],{"class":236},"(events",[222,1725,413],{"class":232},[222,1727,382],{"class":232},[222,1729,1731,1733,1735,1737,1739,1741],{"class":224,"line":1730},10,[222,1732,1687],{"class":402},[222,1734,571],{"class":232},[222,1736,246],{"class":232},[222,1738,1694],{"class":249},[222,1740,405],{"class":232},[222,1742,730],{"class":232},[222,1744,1746,1748],{"class":224,"line":1745},11,[222,1747,424],{"class":232},[222,1749,427],{"class":236},[188,1751,1752],{},"For custom events, use the events-specific functions:",[211,1754,1756],{"className":213,"code":1755,"filename":1633,"language":216,"meta":217,"style":217},"import { sendToPostHogEvents, sendBatchToPostHogEvents, toPostHogEvent } from 'evlog/posthog'\n\n// Send a single custom event\nawait sendToPostHogEvents(event, {\n  apiKey: 'phc_xxx',\n})\n\n// Send multiple custom events in one request\nawait sendBatchToPostHogEvents(events, {\n  apiKey: 'phc_xxx',\n})\n\n// Convert event to PostHog format (for inspection)\nconst posthogEvent = toPostHogEvent(event, { apiKey: 'phc_xxx' })\n",[219,1757,1758,1787,1791,1796,1808,1822,1828,1832,1837,1849,1863,1869,1874,1880],{"__ignoreMap":217},[222,1759,1760,1762,1764,1767,1769,1772,1774,1777,1779,1781,1783,1785],{"class":224,"line":225},[222,1761,229],{"class":228},[222,1763,233],{"class":232},[222,1765,1766],{"class":236}," sendToPostHogEvents",[222,1768,413],{"class":232},[222,1770,1771],{"class":236}," sendBatchToPostHogEvents",[222,1773,413],{"class":232},[222,1775,1776],{"class":236}," toPostHogEvent",[222,1778,240],{"class":232},[222,1780,243],{"class":228},[222,1782,246],{"class":232},[222,1784,250],{"class":249},[222,1786,253],{"class":232},[222,1788,1789],{"class":224,"line":347},[222,1790,351],{"emptyLinePlaceholder":350},[222,1792,1793],{"class":224,"line":354},[222,1794,1795],{"class":597},"// Send a single custom event\n",[222,1797,1798,1800,1802,1804,1806],{"class":224,"line":385},[222,1799,1673],{"class":228},[222,1801,1766],{"class":363},[222,1803,1678],{"class":236},[222,1805,413],{"class":232},[222,1807,382],{"class":232},[222,1809,1810,1812,1814,1816,1818,1820],{"class":224,"line":421},[222,1811,1687],{"class":402},[222,1813,571],{"class":232},[222,1815,246],{"class":232},[222,1817,1694],{"class":249},[222,1819,405],{"class":232},[222,1821,730],{"class":232},[222,1823,1824,1826],{"class":224,"line":615},[222,1825,424],{"class":232},[222,1827,427],{"class":236},[222,1829,1830],{"class":224,"line":621},[222,1831,351],{"emptyLinePlaceholder":350},[222,1833,1834],{"class":224,"line":627},[222,1835,1836],{"class":597},"// Send multiple custom events in one request\n",[222,1838,1839,1841,1843,1845,1847],{"class":224,"line":1716},[222,1840,1673],{"class":228},[222,1842,1771],{"class":363},[222,1844,1723],{"class":236},[222,1846,413],{"class":232},[222,1848,382],{"class":232},[222,1850,1851,1853,1855,1857,1859,1861],{"class":224,"line":1730},[222,1852,1687],{"class":402},[222,1854,571],{"class":232},[222,1856,246],{"class":232},[222,1858,1694],{"class":249},[222,1860,405],{"class":232},[222,1862,730],{"class":232},[222,1864,1865,1867],{"class":224,"line":1745},[222,1866,424],{"class":232},[222,1868,427],{"class":236},[222,1870,1872],{"class":224,"line":1871},12,[222,1873,351],{"emptyLinePlaceholder":350},[222,1875,1877],{"class":224,"line":1876},13,[222,1878,1879],{"class":597},"// Convert event to PostHog format (for inspection)\n",[222,1881,1883,1886,1889,1891,1893,1895,1897,1899,1902,1904,1906,1908,1910,1912],{"class":224,"line":1882},14,[222,1884,1885],{"class":378},"const",[222,1887,1888],{"class":236}," posthogEvent ",[222,1890,314],{"class":232},[222,1892,1776],{"class":363},[222,1894,1678],{"class":236},[222,1896,413],{"class":232},[222,1898,233],{"class":232},[222,1900,1901],{"class":402}," apiKey",[222,1903,571],{"class":232},[222,1905,246],{"class":232},[222,1907,1694],{"class":249},[222,1909,405],{"class":232},[222,1911,240],{"class":232},[222,1913,427],{"class":236},[204,1915,1917],{"id":1916},"next-steps","Next Steps",[853,1919,1920,1926,1932,1937],{},[266,1921,1922,1925],{},[191,1923,1924],{"href":67},"Axiom Adapter"," - Send logs to Axiom",[266,1927,1928,1931],{},[191,1929,1930],{"href":72},"OTLP Adapter"," - Send logs via OpenTelemetry Protocol",[266,1933,1934,1936],{},[191,1935,91],{"href":92}," - Build your own adapter",[266,1938,1939,1941],{},[191,1940,46],{"href":47}," - Security and production tips",[1943,1944,1945],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}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);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":217,"searchDepth":347,"depth":347,"links":1947},[1948,1949,1954,1960,1961,1962,1963,1969,1974,1975],{"id":206,"depth":347,"text":15},{"id":256,"depth":347,"text":20,"children":1950},[1951,1952,1953],{"id":260,"depth":354,"text":261},{"id":297,"depth":354,"text":298},{"id":320,"depth":354,"text":321},{"id":433,"depth":347,"text":434,"children":1955},[1956,1957,1958,1959],{"id":480,"depth":354,"text":481},{"id":536,"depth":354,"text":537},{"id":634,"depth":354,"text":635},{"id":760,"depth":354,"text":761},{"id":840,"depth":347,"text":841},{"id":886,"depth":347,"text":887},{"id":964,"depth":347,"text":965},{"id":988,"depth":347,"text":989,"children":1964},[1965,1966,1967,1968],{"id":1126,"depth":354,"text":1127},{"id":1234,"depth":354,"text":1235},{"id":1329,"depth":354,"text":1330},{"id":1365,"depth":354,"text":1366},{"id":1556,"depth":347,"text":1557,"children":1970},[1971,1972,1973],{"id":1560,"depth":354,"text":1561},{"id":1575,"depth":354,"text":1576},{"id":1602,"depth":354,"text":1603},{"id":1625,"depth":347,"text":1626},{"id":1916,"depth":347,"text":1917},"Send wide events to PostHog Logs via OTLP for structured log querying, debugging, and observability in your PostHog dashboard.","md",[1979,1985],{"label":1980,"icon":1981,"to":271,"target":1982,"color":1983,"variant":1984},"PostHog Dashboard","i-lucide-external-link","_blank","neutral","subtle",{"label":1924,"icon":69,"to":67,"color":1983,"variant":1984},{},{"title":76,"icon":79},{"title":183,"description":1976},"b1vTeji73_62h6glXyE4QX7-PAZECQV548tSQ71oEBY",[1991,1993],{"title":71,"path":72,"stem":73,"description":1992,"icon":74,"children":-1},"Send logs via OpenTelemetry Protocol (OTLP) to Grafana, Datadog, Honeycomb, and any compatible backend. Supports gRPC and HTTP transports.",{"title":81,"path":82,"stem":83,"description":1994,"icon":84,"children":-1},"Send structured logs to Sentry Logs for high-cardinality querying and debugging. Zero-config setup with environment variables.",1772900818598]