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