[{"data":1,"prerenderedAt":1676},["ShallowReactive",2],{"navigation_docs":3,"-adapters-posthog":122,"-adapters-posthog-surround":1671},[4,30,55,105],{"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",{"id":123,"title":124,"body":125,"description":1657,"extension":1658,"links":1659,"meta":1667,"navigation":1668,"path":77,"seo":1669,"stem":78,"__hash__":1670},"docs/3.adapters/4.posthog.md","PostHog Adapter",{"type":126,"value":127,"toc":1630},"minimark",[128,138,142,145,189,192,197,230,234,253,257,363,370,374,377,417,421,462,473,477,484,571,575,578,714,718,835,839,845,886,914,918,921,1003,1012,1016,1019,1121,1125,1134,1296,1300,1303,1327,1330,1354,1358,1362,1370,1373,1377,1380,1400,1404,1410,1423,1427,1430,1598,1602,1626],[129,130,131,137],"p",{},[132,133,76],"a",{"href":134,"rel":135},"https://posthog.com",[136],"nofollow"," is an open-source product analytics platform. The evlog PostHog adapter sends your wide events as PostHog events, letting you query server-side logs alongside your product analytics, session replays, and feature flags.",[139,140,15],"h2",{"id":141},"installation",[129,143,144],{},"The PostHog adapter comes bundled with evlog:",[146,147,153],"pre",{"className":148,"code":149,"filename":150,"language":151,"meta":152,"style":152},"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","",[154,155,156],"code",{"__ignoreMap":152},[157,158,161,165,169,173,176,179,182,186],"span",{"class":159,"line":160},"line",1,[157,162,164],{"class":163},"s7zQu","import",[157,166,168],{"class":167},"sMK4o"," {",[157,170,172],{"class":171},"sTEyZ"," createPostHogDrain",[157,174,175],{"class":167}," }",[157,177,178],{"class":163}," from",[157,180,181],{"class":167}," '",[157,183,185],{"class":184},"sfazB","evlog/posthog",[157,187,188],{"class":167},"'\n",[139,190,20],{"id":191},"quick-start",[193,194,196],"h3",{"id":195},"_1-get-your-posthog-project-api-key","1. Get your PostHog project API key",[198,199,200,209,223],"ol",{},[201,202,203,204],"li",{},"Log in to your ",[132,205,208],{"href":206,"rel":207},"https://app.posthog.com",[136],"PostHog dashboard",[201,210,211,212,216,217,216,220],{},"Go to ",[213,214,215],"strong",{},"Settings"," > ",[213,218,219],{},"Project",[213,221,222],{},"Project API Key",[201,224,225,226,229],{},"Copy the key (starts with ",[154,227,228],{},"phc_",")",[193,231,233],{"id":232},"_2-set-environment-variables","2. Set environment variables",[146,235,240],{"className":236,"code":237,"filename":238,"language":239,"meta":152,"style":152},"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",[154,241,242],{"__ignoreMap":152},[157,243,244,247,250],{"class":159,"line":160},[157,245,246],{"class":171},"NUXT_POSTHOG_API_KEY",[157,248,249],{"class":167},"=",[157,251,252],{"class":184},"phc_your-project-api-key\n",[193,254,256],{"id":255},"_3-create-the-drain-plugin","3. Create the drain plugin",[146,258,260],{"className":148,"code":259,"filename":150,"language":151,"meta":152,"style":152},"import { createPostHogDrain } from 'evlog/posthog'\n\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', createPostHogDrain())\n})\n",[154,261,262,280,287,318,354],{"__ignoreMap":152},[157,263,264,266,268,270,272,274,276,278],{"class":159,"line":160},[157,265,164],{"class":163},[157,267,168],{"class":167},[157,269,172],{"class":171},[157,271,175],{"class":167},[157,273,178],{"class":163},[157,275,181],{"class":167},[157,277,185],{"class":184},[157,279,188],{"class":167},[157,281,283],{"class":159,"line":282},2,[157,284,286],{"emptyLinePlaceholder":285},true,"\n",[157,288,290,293,296,300,303,305,309,311,315],{"class":159,"line":289},3,[157,291,292],{"class":163},"export",[157,294,295],{"class":163}," default",[157,297,299],{"class":298},"s2Zo4"," defineNitroPlugin",[157,301,302],{"class":171},"(",[157,304,302],{"class":167},[157,306,308],{"class":307},"sHdIc","nitroApp",[157,310,229],{"class":167},[157,312,314],{"class":313},"spNyl"," =>",[157,316,317],{"class":167}," {\n",[157,319,321,324,327,330,332,335,338,341,344,346,349,351],{"class":159,"line":320},4,[157,322,323],{"class":171},"  nitroApp",[157,325,326],{"class":167},".",[157,328,329],{"class":171},"hooks",[157,331,326],{"class":167},[157,333,334],{"class":298},"hook",[157,336,302],{"class":337},"swJcz",[157,339,340],{"class":167},"'",[157,342,343],{"class":184},"evlog:drain",[157,345,340],{"class":167},[157,347,348],{"class":167},",",[157,350,172],{"class":298},[157,352,353],{"class":337},"())\n",[157,355,357,360],{"class":159,"line":356},5,[157,358,359],{"class":167},"}",[157,361,362],{"class":171},")\n",[129,364,365,366,369],{},"That's it! Your wide events will now appear in PostHog as ",[154,367,368],{},"evlog_wide_event"," events.",[139,371,373],{"id":372},"configuration","Configuration",[129,375,376],{},"The adapter reads configuration from multiple sources (highest priority first):",[198,378,379,388,397,404],{},[201,380,381,384,385],{},[213,382,383],{},"Overrides"," passed to ",[154,386,387],{},"createPostHogDrain()",[201,389,390,393,394],{},[213,391,392],{},"Runtime config"," at ",[154,395,396],{},"runtimeConfig.evlog.posthog",[201,398,399,393,401],{},[213,400,392],{},[154,402,403],{},"runtimeConfig.posthog",[201,405,406,409,410,413,414,229],{},[213,407,408],{},"Environment variables"," (",[154,411,412],{},"NUXT_POSTHOG_*"," or ",[154,415,416],{},"POSTHOG_*",[193,418,420],{"id":419},"environment-variables","Environment Variables",[422,423,424,437],"table",{},[425,426,427],"thead",{},[428,429,430,434],"tr",{},[431,432,433],"th",{},"Variable",[431,435,436],{},"Description",[438,439,440,452],"tbody",{},[428,441,442,447],{},[443,444,445],"td",{},[154,446,246],{},[443,448,449,450,229],{},"Project API key (starts with ",[154,451,228],{},[428,453,454,459],{},[443,455,456],{},[154,457,458],{},"NUXT_POSTHOG_HOST",[443,460,461],{},"PostHog host URL (for EU or self-hosted)",[129,463,464,465,468,469,472],{},"You can also use ",[154,466,467],{},"POSTHOG_API_KEY"," and ",[154,470,471],{},"POSTHOG_HOST"," as fallbacks.",[193,474,476],{"id":475},"runtime-config","Runtime Config",[129,478,479,480,483],{},"Configure via ",[154,481,482],{},"nuxt.config.ts"," for type-safe configuration:",[146,485,487],{"className":148,"code":486,"filename":482,"language":151,"meta":152,"style":152},"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",[154,488,489,503,513,522,538,552,558,564],{"__ignoreMap":152},[157,490,491,493,495,498,500],{"class":159,"line":160},[157,492,292],{"class":163},[157,494,295],{"class":163},[157,496,497],{"class":298}," defineNuxtConfig",[157,499,302],{"class":171},[157,501,502],{"class":167},"{\n",[157,504,505,508,511],{"class":159,"line":282},[157,506,507],{"class":337},"  runtimeConfig",[157,509,510],{"class":167},":",[157,512,317],{"class":167},[157,514,515,518,520],{"class":159,"line":289},[157,516,517],{"class":337},"    posthog",[157,519,510],{"class":167},[157,521,317],{"class":167},[157,523,524,527,529,532,534],{"class":159,"line":320},[157,525,526],{"class":337},"      apiKey",[157,528,510],{"class":167},[157,530,531],{"class":167}," ''",[157,533,348],{"class":167},[157,535,537],{"class":536},"sHwdD"," // Set via NUXT_POSTHOG_API_KEY\n",[157,539,540,543,545,547,549],{"class":159,"line":356},[157,541,542],{"class":337},"      host",[157,544,510],{"class":167},[157,546,531],{"class":167},[157,548,348],{"class":167},[157,550,551],{"class":536}," // Set via NUXT_POSTHOG_HOST\n",[157,553,555],{"class":159,"line":554},6,[157,556,557],{"class":167},"    },\n",[157,559,561],{"class":159,"line":560},7,[157,562,563],{"class":167},"  },\n",[157,565,567,569],{"class":159,"line":566},8,[157,568,359],{"class":167},[157,570,362],{"class":171},[193,572,574],{"id":573},"override-options","Override Options",[129,576,577],{},"Pass options directly to override any configuration:",[146,579,581],{"className":148,"code":580,"filename":150,"language":151,"meta":152,"style":152},"import { createPostHogDrain } from 'evlog/posthog'\n\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', createPostHogDrain({\n    eventName: 'server_request',\n    distinctId: 'my-backend-service',\n    timeout: 10000,\n  }))\n})\n",[154,582,583,601,605,625,653,670,686,699,707],{"__ignoreMap":152},[157,584,585,587,589,591,593,595,597,599],{"class":159,"line":160},[157,586,164],{"class":163},[157,588,168],{"class":167},[157,590,172],{"class":171},[157,592,175],{"class":167},[157,594,178],{"class":163},[157,596,181],{"class":167},[157,598,185],{"class":184},[157,600,188],{"class":167},[157,602,603],{"class":159,"line":282},[157,604,286],{"emptyLinePlaceholder":285},[157,606,607,609,611,613,615,617,619,621,623],{"class":159,"line":289},[157,608,292],{"class":163},[157,610,295],{"class":163},[157,612,299],{"class":298},[157,614,302],{"class":171},[157,616,302],{"class":167},[157,618,308],{"class":307},[157,620,229],{"class":167},[157,622,314],{"class":313},[157,624,317],{"class":167},[157,626,627,629,631,633,635,637,639,641,643,645,647,649,651],{"class":159,"line":320},[157,628,323],{"class":171},[157,630,326],{"class":167},[157,632,329],{"class":171},[157,634,326],{"class":167},[157,636,334],{"class":298},[157,638,302],{"class":337},[157,640,340],{"class":167},[157,642,343],{"class":184},[157,644,340],{"class":167},[157,646,348],{"class":167},[157,648,172],{"class":298},[157,650,302],{"class":337},[157,652,502],{"class":167},[157,654,655,658,660,662,665,667],{"class":159,"line":356},[157,656,657],{"class":337},"    eventName",[157,659,510],{"class":167},[157,661,181],{"class":167},[157,663,664],{"class":184},"server_request",[157,666,340],{"class":167},[157,668,669],{"class":167},",\n",[157,671,672,675,677,679,682,684],{"class":159,"line":554},[157,673,674],{"class":337},"    distinctId",[157,676,510],{"class":167},[157,678,181],{"class":167},[157,680,681],{"class":184},"my-backend-service",[157,683,340],{"class":167},[157,685,669],{"class":167},[157,687,688,691,693,697],{"class":159,"line":560},[157,689,690],{"class":337},"    timeout",[157,692,510],{"class":167},[157,694,696],{"class":695},"sbssI"," 10000",[157,698,669],{"class":167},[157,700,701,704],{"class":159,"line":566},[157,702,703],{"class":167},"  }",[157,705,706],{"class":337},"))\n",[157,708,710,712],{"class":159,"line":709},9,[157,711,359],{"class":167},[157,713,362],{"class":171},[193,715,717],{"id":716},"full-configuration-reference","Full Configuration Reference",[422,719,720,735],{},[425,721,722],{},[428,723,724,727,730,733],{},[431,725,726],{},"Option",[431,728,729],{},"Type",[431,731,732],{},"Default",[431,734,436],{},[438,736,737,755,774,792,815],{},[428,738,739,744,749,752],{},[443,740,741],{},[154,742,743],{},"apiKey",[443,745,746],{},[154,747,748],{},"string",[443,750,751],{},"-",[443,753,754],{},"Project API key (required)",[428,756,757,762,766,771],{},[443,758,759],{},[154,760,761],{},"host",[443,763,764],{},[154,765,748],{},[443,767,768],{},[154,769,770],{},"https://us.i.posthog.com",[443,772,773],{},"PostHog host URL",[428,775,776,781,785,789],{},[443,777,778],{},[154,779,780],{},"eventName",[443,782,783],{},[154,784,748],{},[443,786,787],{},[154,788,368],{},[443,790,791],{},"PostHog event name",[428,793,794,799,803,808],{},[443,795,796],{},[154,797,798],{},"distinctId",[443,800,801],{},[154,802,748],{},[443,804,805],{},[154,806,807],{},"event.service",[443,809,810,811,814],{},"Override ",[154,812,813],{},"distinct_id"," for all events",[428,816,817,822,827,832],{},[443,818,819],{},[154,820,821],{},"timeout",[443,823,824],{},[154,825,826],{},"number",[443,828,829],{},[154,830,831],{},"5000",[443,833,834],{},"Request timeout in milliseconds",[139,836,838],{"id":837},"regions","Regions",[129,840,841,842,844],{},"PostHog offers US and EU cloud hosting. Set the ",[154,843,761],{}," to match your region:",[422,846,847,857],{},[425,848,849],{},[428,850,851,854],{},[431,852,853],{},"Region",[431,855,856],{},"Host",[438,858,859,868,878],{},[428,860,861,864],{},[443,862,863],{},"US (default)",[443,865,866],{},[154,867,770],{},[428,869,870,873],{},[443,871,872],{},"EU",[443,874,875],{},[154,876,877],{},"https://eu.i.posthog.com",[428,879,880,883],{},[443,881,882],{},"Self-hosted",[443,884,885],{},"Your instance URL",[146,887,889],{"className":236,"code":888,"filename":238,"language":239,"meta":152,"style":152},"# EU region\nNUXT_POSTHOG_API_KEY=phc_xxx\nNUXT_POSTHOG_HOST=https://eu.i.posthog.com\n",[154,890,891,896,905],{"__ignoreMap":152},[157,892,893],{"class":159,"line":160},[157,894,895],{"class":536},"# EU region\n",[157,897,898,900,902],{"class":159,"line":282},[157,899,246],{"class":171},[157,901,249],{"class":167},[157,903,904],{"class":184},"phc_xxx\n",[157,906,907,909,911],{"class":159,"line":289},[157,908,458],{"class":171},[157,910,249],{"class":167},[157,912,913],{"class":184},"https://eu.i.posthog.com\n",[139,915,917],{"id":916},"event-format","Event Format",[129,919,920],{},"evlog maps wide events to PostHog events:",[422,922,923,933],{},[425,924,925],{},[428,926,927,930],{},[431,928,929],{},"evlog Field",[431,931,932],{},"PostHog Field",[438,934,935,947,958,970,981,993],{},[428,936,937,942],{},[443,938,939],{},[154,940,941],{},"service",[443,943,944,946],{},[154,945,813],{}," (default)",[428,948,949,954],{},[443,950,951],{},[154,952,953],{},"timestamp",[443,955,956],{},[154,957,953],{},[428,959,960,965],{},[443,961,962],{},[154,963,964],{},"level",[443,966,967],{},[154,968,969],{},"properties.level",[428,971,972,976],{},[443,973,974],{},[154,975,941],{},[443,977,978],{},[154,979,980],{},"properties.service",[428,982,983,988],{},[443,984,985],{},[154,986,987],{},"environment",[443,989,990],{},[154,991,992],{},"properties.environment",[428,994,995,998],{},[443,996,997],{},"All other fields",[443,999,1000],{},[154,1001,1002],{},"properties.*",[129,1004,1005,1006,1008,1009,1011],{},"The event name defaults to ",[154,1007,368],{}," but can be customized via the ",[154,1010,780],{}," option.",[193,1013,1015],{"id":1014},"custom-event-name","Custom Event Name",[129,1017,1018],{},"Use a custom event name to differentiate log types in PostHog:",[146,1020,1022],{"className":148,"code":1021,"filename":150,"language":151,"meta":152,"style":152},"import { createPostHogDrain } from 'evlog/posthog'\n\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', createPostHogDrain({\n    eventName: 'server_wide_event',\n  }))\n})\n",[154,1023,1024,1042,1046,1066,1094,1109,1115],{"__ignoreMap":152},[157,1025,1026,1028,1030,1032,1034,1036,1038,1040],{"class":159,"line":160},[157,1027,164],{"class":163},[157,1029,168],{"class":167},[157,1031,172],{"class":171},[157,1033,175],{"class":167},[157,1035,178],{"class":163},[157,1037,181],{"class":167},[157,1039,185],{"class":184},[157,1041,188],{"class":167},[157,1043,1044],{"class":159,"line":282},[157,1045,286],{"emptyLinePlaceholder":285},[157,1047,1048,1050,1052,1054,1056,1058,1060,1062,1064],{"class":159,"line":289},[157,1049,292],{"class":163},[157,1051,295],{"class":163},[157,1053,299],{"class":298},[157,1055,302],{"class":171},[157,1057,302],{"class":167},[157,1059,308],{"class":307},[157,1061,229],{"class":167},[157,1063,314],{"class":313},[157,1065,317],{"class":167},[157,1067,1068,1070,1072,1074,1076,1078,1080,1082,1084,1086,1088,1090,1092],{"class":159,"line":320},[157,1069,323],{"class":171},[157,1071,326],{"class":167},[157,1073,329],{"class":171},[157,1075,326],{"class":167},[157,1077,334],{"class":298},[157,1079,302],{"class":337},[157,1081,340],{"class":167},[157,1083,343],{"class":184},[157,1085,340],{"class":167},[157,1087,348],{"class":167},[157,1089,172],{"class":298},[157,1091,302],{"class":337},[157,1093,502],{"class":167},[157,1095,1096,1098,1100,1102,1105,1107],{"class":159,"line":356},[157,1097,657],{"class":337},[157,1099,510],{"class":167},[157,1101,181],{"class":167},[157,1103,1104],{"class":184},"server_wide_event",[157,1106,340],{"class":167},[157,1108,669],{"class":167},[157,1110,1111,1113],{"class":159,"line":554},[157,1112,703],{"class":167},[157,1114,706],{"class":337},[157,1116,1117,1119],{"class":159,"line":560},[157,1118,359],{"class":167},[157,1120,362],{"class":171},[193,1122,1124],{"id":1123},"custom-distinct-id","Custom Distinct ID",[129,1126,1127,1128,1130,1131,1133],{},"By default, ",[154,1129,813],{}," is set to the event's ",[154,1132,941],{}," name. Override it to correlate with your users:",[146,1135,1137],{"className":148,"code":1136,"filename":150,"language":151,"meta":152,"style":152},"export default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', async (ctx) => {\n    const posthogDrain = createPostHogDrain({\n      // Use the user ID from the wide event if available\n      distinctId: ctx.event.userId as string ?? ctx.event.service,\n    })\n\n    await posthogDrain(ctx)\n  })\n})\n",[154,1138,1139,1159,1195,1212,1217,1259,1266,1270,1283,1289],{"__ignoreMap":152},[157,1140,1141,1143,1145,1147,1149,1151,1153,1155,1157],{"class":159,"line":160},[157,1142,292],{"class":163},[157,1144,295],{"class":163},[157,1146,299],{"class":298},[157,1148,302],{"class":171},[157,1150,302],{"class":167},[157,1152,308],{"class":307},[157,1154,229],{"class":167},[157,1156,314],{"class":313},[157,1158,317],{"class":167},[157,1160,1161,1163,1165,1167,1169,1171,1173,1175,1177,1179,1181,1184,1186,1189,1191,1193],{"class":159,"line":282},[157,1162,323],{"class":171},[157,1164,326],{"class":167},[157,1166,329],{"class":171},[157,1168,326],{"class":167},[157,1170,334],{"class":298},[157,1172,302],{"class":337},[157,1174,340],{"class":167},[157,1176,343],{"class":184},[157,1178,340],{"class":167},[157,1180,348],{"class":167},[157,1182,1183],{"class":313}," async",[157,1185,409],{"class":167},[157,1187,1188],{"class":307},"ctx",[157,1190,229],{"class":167},[157,1192,314],{"class":313},[157,1194,317],{"class":167},[157,1196,1197,1200,1203,1206,1208,1210],{"class":159,"line":289},[157,1198,1199],{"class":313},"    const",[157,1201,1202],{"class":171}," posthogDrain",[157,1204,1205],{"class":167}," =",[157,1207,172],{"class":298},[157,1209,302],{"class":337},[157,1211,502],{"class":167},[157,1213,1214],{"class":159,"line":320},[157,1215,1216],{"class":536},"      // Use the user ID from the wide event if available\n",[157,1218,1219,1222,1224,1227,1229,1232,1234,1237,1240,1244,1247,1249,1251,1253,1255,1257],{"class":159,"line":356},[157,1220,1221],{"class":337},"      distinctId",[157,1223,510],{"class":167},[157,1225,1226],{"class":171}," ctx",[157,1228,326],{"class":167},[157,1230,1231],{"class":171},"event",[157,1233,326],{"class":167},[157,1235,1236],{"class":171},"userId",[157,1238,1239],{"class":163}," as",[157,1241,1243],{"class":1242},"sBMFI"," string",[157,1245,1246],{"class":167}," ??",[157,1248,1226],{"class":171},[157,1250,326],{"class":167},[157,1252,1231],{"class":171},[157,1254,326],{"class":167},[157,1256,941],{"class":171},[157,1258,669],{"class":167},[157,1260,1261,1264],{"class":159,"line":554},[157,1262,1263],{"class":167},"    }",[157,1265,362],{"class":337},[157,1267,1268],{"class":159,"line":560},[157,1269,286],{"emptyLinePlaceholder":285},[157,1271,1272,1275,1277,1279,1281],{"class":159,"line":566},[157,1273,1274],{"class":163},"    await",[157,1276,1202],{"class":298},[157,1278,302],{"class":337},[157,1280,1188],{"class":171},[157,1282,362],{"class":337},[157,1284,1285,1287],{"class":159,"line":709},[157,1286,703],{"class":167},[157,1288,362],{"class":337},[157,1290,1292,1294],{"class":159,"line":1291},10,[157,1293,359],{"class":167},[157,1295,362],{"class":171},[139,1297,1299],{"id":1298},"querying-logs-in-posthog","Querying Logs in PostHog",[129,1301,1302],{},"Once your events are flowing, you can query them in PostHog:",[198,1304,1305,1313,1320],{},[201,1306,211,1307,1310,1311],{},[213,1308,1309],{},"Events"," and filter by ",[154,1312,368],{},[201,1314,1315,1316,1319],{},"Use ",[213,1317,1318],{},"Insights"," to build dashboards on your wide event properties",[201,1321,1322,1323,1326],{},"Create ",[213,1324,1325],{},"Cohorts"," based on server-side behavior (e.g., users who triggered errors)",[129,1328,1329],{},"Example queries you can build:",[1331,1332,1333,1343,1349],"ul",{},[201,1334,1335,1336,1339,1340,229],{},"Error rate by endpoint (",[154,1337,1338],{},"properties.path",", ",[154,1341,1342],{},"properties.level = error",[201,1344,1345,1346,229],{},"Slow requests over time (",[154,1347,1348],{},"properties.duration > 1000",[201,1350,1351,1352,229],{},"Request volume by service (",[154,1353,980],{},[139,1355,1357],{"id":1356},"troubleshooting","Troubleshooting",[193,1359,1361],{"id":1360},"missing-apikey-error","Missing apiKey error",[146,1363,1368],{"className":1364,"code":1366,"language":1367},[1365],"language-text","[evlog/posthog] Missing apiKey. Set NUXT_POSTHOG_API_KEY/POSTHOG_API_KEY env var or pass to createPostHogDrain()\n","text",[154,1369,1366],{"__ignoreMap":152},[129,1371,1372],{},"Make sure your environment variable is set and the server was restarted after adding it.",[193,1374,1376],{"id":1375},"events-not-appearing","Events not appearing",[129,1378,1379],{},"PostHog processes events asynchronously. There may be a short delay (typically under 1 minute) before events appear in the dashboard.",[198,1381,1382,1389,1394],{},[201,1383,1384,1385,1388],{},"Check the server console for ",[154,1386,1387],{},"[evlog/posthog]"," error messages",[201,1390,1391,1392],{},"Verify your API key is correct and starts with ",[154,1393,228],{},[201,1395,1396,1397,1399],{},"Confirm your ",[154,1398,761],{}," matches your PostHog region (US vs EU)",[193,1401,1403],{"id":1402},"wrong-region","Wrong region",[129,1405,1406,1407,1409],{},"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 ",[154,1408,1387],{},") to your server console. Set the correct host:",[146,1411,1413],{"className":236,"code":1412,"filename":238,"language":239,"meta":152,"style":152},"NUXT_POSTHOG_HOST=https://eu.i.posthog.com\n",[154,1414,1415],{"__ignoreMap":152},[157,1416,1417,1419,1421],{"class":159,"line":160},[157,1418,458],{"class":171},[157,1420,249],{"class":167},[157,1422,913],{"class":184},[139,1424,1426],{"id":1425},"direct-api-usage","Direct API Usage",[129,1428,1429],{},"For advanced use cases, you can use the lower-level functions:",[146,1431,1434],{"className":148,"code":1432,"filename":1433,"language":151,"meta":152,"style":152},"import { sendToPostHog, sendBatchToPostHog, toPostHogEvent } from 'evlog/posthog'\n\n// Send a single event\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\n// Convert event to PostHog format (for inspection)\nconst posthogEvent = toPostHogEvent(event, { apiKey: 'phc_xxx' })\n","server/utils/posthog.ts",[154,1435,1436,1465,1469,1474,1488,1504,1510,1514,1519,1532,1546,1553,1558,1564],{"__ignoreMap":152},[157,1437,1438,1440,1442,1445,1447,1450,1452,1455,1457,1459,1461,1463],{"class":159,"line":160},[157,1439,164],{"class":163},[157,1441,168],{"class":167},[157,1443,1444],{"class":171}," sendToPostHog",[157,1446,348],{"class":167},[157,1448,1449],{"class":171}," sendBatchToPostHog",[157,1451,348],{"class":167},[157,1453,1454],{"class":171}," toPostHogEvent",[157,1456,175],{"class":167},[157,1458,178],{"class":163},[157,1460,181],{"class":167},[157,1462,185],{"class":184},[157,1464,188],{"class":167},[157,1466,1467],{"class":159,"line":282},[157,1468,286],{"emptyLinePlaceholder":285},[157,1470,1471],{"class":159,"line":289},[157,1472,1473],{"class":536},"// Send a single event\n",[157,1475,1476,1479,1481,1484,1486],{"class":159,"line":320},[157,1477,1478],{"class":163},"await",[157,1480,1444],{"class":298},[157,1482,1483],{"class":171},"(event",[157,1485,348],{"class":167},[157,1487,317],{"class":167},[157,1489,1490,1493,1495,1497,1500,1502],{"class":159,"line":356},[157,1491,1492],{"class":337},"  apiKey",[157,1494,510],{"class":167},[157,1496,181],{"class":167},[157,1498,1499],{"class":184},"phc_xxx",[157,1501,340],{"class":167},[157,1503,669],{"class":167},[157,1505,1506,1508],{"class":159,"line":554},[157,1507,359],{"class":167},[157,1509,362],{"class":171},[157,1511,1512],{"class":159,"line":560},[157,1513,286],{"emptyLinePlaceholder":285},[157,1515,1516],{"class":159,"line":566},[157,1517,1518],{"class":536},"// Send multiple events in one request\n",[157,1520,1521,1523,1525,1528,1530],{"class":159,"line":709},[157,1522,1478],{"class":163},[157,1524,1449],{"class":298},[157,1526,1527],{"class":171},"(events",[157,1529,348],{"class":167},[157,1531,317],{"class":167},[157,1533,1534,1536,1538,1540,1542,1544],{"class":159,"line":1291},[157,1535,1492],{"class":337},[157,1537,510],{"class":167},[157,1539,181],{"class":167},[157,1541,1499],{"class":184},[157,1543,340],{"class":167},[157,1545,669],{"class":167},[157,1547,1549,1551],{"class":159,"line":1548},11,[157,1550,359],{"class":167},[157,1552,362],{"class":171},[157,1554,1556],{"class":159,"line":1555},12,[157,1557,286],{"emptyLinePlaceholder":285},[157,1559,1561],{"class":159,"line":1560},13,[157,1562,1563],{"class":536},"// Convert event to PostHog format (for inspection)\n",[157,1565,1567,1570,1573,1575,1577,1579,1581,1583,1586,1588,1590,1592,1594,1596],{"class":159,"line":1566},14,[157,1568,1569],{"class":313},"const",[157,1571,1572],{"class":171}," posthogEvent ",[157,1574,249],{"class":167},[157,1576,1454],{"class":298},[157,1578,1483],{"class":171},[157,1580,348],{"class":167},[157,1582,168],{"class":167},[157,1584,1585],{"class":337}," apiKey",[157,1587,510],{"class":167},[157,1589,181],{"class":167},[157,1591,1499],{"class":184},[157,1593,340],{"class":167},[157,1595,175],{"class":167},[157,1597,362],{"class":171},[139,1599,1601],{"id":1600},"next-steps","Next Steps",[1331,1603,1604,1610,1616,1621],{},[201,1605,1606,1609],{},[132,1607,1608],{"href":67},"Axiom Adapter"," - Send logs to Axiom",[201,1611,1612,1615],{},[132,1613,1614],{"href":72},"OTLP Adapter"," - Send logs via OpenTelemetry Protocol",[201,1617,1618,1620],{},[132,1619,91],{"href":92}," - Build your own adapter",[201,1622,1623,1625],{},[132,1624,46],{"href":47}," - Security and production tips",[1627,1628,1629],"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}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}",{"title":152,"searchDepth":282,"depth":282,"links":1631},[1632,1633,1638,1644,1645,1649,1650,1655,1656],{"id":141,"depth":282,"text":15},{"id":191,"depth":282,"text":20,"children":1634},[1635,1636,1637],{"id":195,"depth":289,"text":196},{"id":232,"depth":289,"text":233},{"id":255,"depth":289,"text":256},{"id":372,"depth":282,"text":373,"children":1639},[1640,1641,1642,1643],{"id":419,"depth":289,"text":420},{"id":475,"depth":289,"text":476},{"id":573,"depth":289,"text":574},{"id":716,"depth":289,"text":717},{"id":837,"depth":282,"text":838},{"id":916,"depth":282,"text":917,"children":1646},[1647,1648],{"id":1014,"depth":289,"text":1015},{"id":1123,"depth":289,"text":1124},{"id":1298,"depth":282,"text":1299},{"id":1356,"depth":282,"text":1357,"children":1651},[1652,1653,1654],{"id":1360,"depth":289,"text":1361},{"id":1375,"depth":289,"text":1376},{"id":1402,"depth":289,"text":1403},{"id":1425,"depth":282,"text":1426},{"id":1600,"depth":282,"text":1601},"Send logs to PostHog as events for product analytics, session replay correlation, and wide event querying.","md",[1660,1666],{"label":1661,"icon":1662,"to":206,"target":1663,"color":1664,"variant":1665},"PostHog Dashboard","i-lucide-external-link","_blank","neutral","subtle",{"label":1608,"icon":69,"to":67,"color":1664,"variant":1665},{},{"title":76,"icon":79},{"title":124,"description":1657},"I3zAHet8HN5ZinZn_p3AItgY3U0DxJP4vQjlcy8K92U",[1672,1674],{"title":71,"path":72,"stem":73,"description":1673,"icon":74,"children":-1},"Send logs via OpenTelemetry Protocol to Grafana, Datadog, Honeycomb, and any OTLP-compatible backend.",{"title":81,"path":82,"stem":83,"description":1675,"icon":84,"children":-1},"Send structured logs to Sentry Logs for high-cardinality querying and debugging. Zero-config setup with environment variables.",1771081860362]