[{"data":1,"prerenderedAt":1731},["ShallowReactive",2],{"navigation_docs":3,"-adapters-posthog":122,"-adapters-posthog-surround":1726},[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":1712,"extension":1713,"links":1714,"meta":1722,"navigation":1723,"path":77,"seo":1724,"stem":78,"__hash__":1725},"docs/3.adapters/4.posthog.md","PostHog Adapter",{"type":126,"value":127,"toc":1685},"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,1009,1018,1022,1025,1127,1131,1137,1163,1176,1256,1268,1350,1354,1357,1381,1384,1408,1412,1416,1424,1427,1431,1434,1454,1458,1464,1477,1481,1484,1653,1657,1681],[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,953,964,976,987,999],{},[428,936,937,948],{},[443,938,939,413,942,413,945],{},[154,940,941],{},"config.distinctId",[154,943,944],{},"userId",[154,946,947],{},"service",[443,949,950,952],{},[154,951,813],{}," (fallback chain)",[428,954,955,960],{},[443,956,957],{},[154,958,959],{},"timestamp",[443,961,962],{},[154,963,959],{},[428,965,966,971],{},[443,967,968],{},[154,969,970],{},"level",[443,972,973],{},[154,974,975],{},"properties.level",[428,977,978,982],{},[443,979,980],{},[154,981,947],{},[443,983,984],{},[154,985,986],{},"properties.service",[428,988,989,994],{},[443,990,991],{},[154,992,993],{},"environment",[443,995,996],{},[154,997,998],{},"properties.environment",[428,1000,1001,1004],{},[443,1002,1003],{},"All other fields",[443,1005,1006],{},[154,1007,1008],{},"properties.*",[129,1010,1011,1012,1014,1015,1017],{},"The event name defaults to ",[154,1013,368],{}," but can be customized via the ",[154,1016,780],{}," option.",[193,1019,1021],{"id":1020},"custom-event-name","Custom Event Name",[129,1023,1024],{},"Use a custom event name to differentiate log types in PostHog:",[146,1026,1028],{"className":148,"code":1027,"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,1029,1030,1048,1052,1072,1100,1115,1121],{"__ignoreMap":152},[157,1031,1032,1034,1036,1038,1040,1042,1044,1046],{"class":159,"line":160},[157,1033,164],{"class":163},[157,1035,168],{"class":167},[157,1037,172],{"class":171},[157,1039,175],{"class":167},[157,1041,178],{"class":163},[157,1043,181],{"class":167},[157,1045,185],{"class":184},[157,1047,188],{"class":167},[157,1049,1050],{"class":159,"line":282},[157,1051,286],{"emptyLinePlaceholder":285},[157,1053,1054,1056,1058,1060,1062,1064,1066,1068,1070],{"class":159,"line":289},[157,1055,292],{"class":163},[157,1057,295],{"class":163},[157,1059,299],{"class":298},[157,1061,302],{"class":171},[157,1063,302],{"class":167},[157,1065,308],{"class":307},[157,1067,229],{"class":167},[157,1069,314],{"class":313},[157,1071,317],{"class":167},[157,1073,1074,1076,1078,1080,1082,1084,1086,1088,1090,1092,1094,1096,1098],{"class":159,"line":320},[157,1075,323],{"class":171},[157,1077,326],{"class":167},[157,1079,329],{"class":171},[157,1081,326],{"class":167},[157,1083,334],{"class":298},[157,1085,302],{"class":337},[157,1087,340],{"class":167},[157,1089,343],{"class":184},[157,1091,340],{"class":167},[157,1093,348],{"class":167},[157,1095,172],{"class":298},[157,1097,302],{"class":337},[157,1099,502],{"class":167},[157,1101,1102,1104,1106,1108,1111,1113],{"class":159,"line":356},[157,1103,657],{"class":337},[157,1105,510],{"class":167},[157,1107,181],{"class":167},[157,1109,1110],{"class":184},"server_wide_event",[157,1112,340],{"class":167},[157,1114,669],{"class":167},[157,1116,1117,1119],{"class":159,"line":554},[157,1118,703],{"class":167},[157,1120,706],{"class":337},[157,1122,1123,1125],{"class":159,"line":560},[157,1124,359],{"class":167},[157,1126,362],{"class":171},[193,1128,1130],{"id":1129},"custom-distinct-id","Custom Distinct ID",[129,1132,1133,1134,1136],{},"The ",[154,1135,813],{}," follows a fallback chain:",[198,1138,1139,1148,1156],{},[201,1140,1141,1145,1146],{},[213,1142,1143],{},[154,1144,941],{}," — explicit override in ",[154,1147,387],{},[201,1149,1150,1155],{},[213,1151,1152],{},[154,1153,1154],{},"event.userId"," — automatically picked up if present as a string",[201,1157,1158,1162],{},[213,1159,1160],{},[154,1161,807],{}," — final fallback",[129,1164,1165,1166,1169,1170,1172,1173,1175],{},"This means if you use ",[154,1167,1168],{},"setIdentity({ userId: 'usr_123' })"," on the client, the ",[154,1171,944],{}," flows through client transport → server ingest → PostHog drain, and is automatically used as ",[154,1174,813],{},". No additional configuration needed.",[146,1177,1179],{"className":148,"code":1178,"language":151,"meta":152,"style":152},"// Client-side — identity is set once (e.g. after login)\nsetIdentity({ userId: 'usr_123' })\n\n// Every log now includes userId\nlog.info({ action: 'checkout' })\n// → PostHog event with distinct_id: 'usr_123'\n",[154,1180,1181,1186,1212,1216,1221,1251],{"__ignoreMap":152},[157,1182,1183],{"class":159,"line":160},[157,1184,1185],{"class":536},"// Client-side — identity is set once (e.g. after login)\n",[157,1187,1188,1191,1193,1196,1199,1201,1203,1206,1208,1210],{"class":159,"line":282},[157,1189,1190],{"class":298},"setIdentity",[157,1192,302],{"class":171},[157,1194,1195],{"class":167},"{",[157,1197,1198],{"class":337}," userId",[157,1200,510],{"class":167},[157,1202,181],{"class":167},[157,1204,1205],{"class":184},"usr_123",[157,1207,340],{"class":167},[157,1209,175],{"class":167},[157,1211,362],{"class":171},[157,1213,1214],{"class":159,"line":289},[157,1215,286],{"emptyLinePlaceholder":285},[157,1217,1218],{"class":159,"line":320},[157,1219,1220],{"class":536},"// Every log now includes userId\n",[157,1222,1223,1226,1228,1231,1233,1235,1238,1240,1242,1245,1247,1249],{"class":159,"line":356},[157,1224,1225],{"class":171},"log",[157,1227,326],{"class":167},[157,1229,1230],{"class":298},"info",[157,1232,302],{"class":171},[157,1234,1195],{"class":167},[157,1236,1237],{"class":337}," action",[157,1239,510],{"class":167},[157,1241,181],{"class":167},[157,1243,1244],{"class":184},"checkout",[157,1246,340],{"class":167},[157,1248,175],{"class":167},[157,1250,362],{"class":171},[157,1252,1253],{"class":159,"line":554},[157,1254,1255],{"class":536},"// → PostHog event with distinct_id: 'usr_123'\n",[129,1257,1258,1259,1261,1262,1264,1265,1267],{},"To override ",[154,1260,813],{}," for all events regardless of ",[154,1263,944],{},", pass ",[154,1266,798],{}," to the drain:",[146,1269,1271],{"className":148,"code":1270,"filename":150,"language":151,"meta":152,"style":152},"export default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', createPostHogDrain({\n    distinctId: 'my-backend-service', // Always uses this value\n  }))\n})\n",[154,1272,1273,1293,1321,1338,1344],{"__ignoreMap":152},[157,1274,1275,1277,1279,1281,1283,1285,1287,1289,1291],{"class":159,"line":160},[157,1276,292],{"class":163},[157,1278,295],{"class":163},[157,1280,299],{"class":298},[157,1282,302],{"class":171},[157,1284,302],{"class":167},[157,1286,308],{"class":307},[157,1288,229],{"class":167},[157,1290,314],{"class":313},[157,1292,317],{"class":167},[157,1294,1295,1297,1299,1301,1303,1305,1307,1309,1311,1313,1315,1317,1319],{"class":159,"line":282},[157,1296,323],{"class":171},[157,1298,326],{"class":167},[157,1300,329],{"class":171},[157,1302,326],{"class":167},[157,1304,334],{"class":298},[157,1306,302],{"class":337},[157,1308,340],{"class":167},[157,1310,343],{"class":184},[157,1312,340],{"class":167},[157,1314,348],{"class":167},[157,1316,172],{"class":298},[157,1318,302],{"class":337},[157,1320,502],{"class":167},[157,1322,1323,1325,1327,1329,1331,1333,1335],{"class":159,"line":289},[157,1324,674],{"class":337},[157,1326,510],{"class":167},[157,1328,181],{"class":167},[157,1330,681],{"class":184},[157,1332,340],{"class":167},[157,1334,348],{"class":167},[157,1336,1337],{"class":536}," // Always uses this value\n",[157,1339,1340,1342],{"class":159,"line":320},[157,1341,703],{"class":167},[157,1343,706],{"class":337},[157,1345,1346,1348],{"class":159,"line":356},[157,1347,359],{"class":167},[157,1349,362],{"class":171},[139,1351,1353],{"id":1352},"querying-logs-in-posthog","Querying Logs in PostHog",[129,1355,1356],{},"Once your events are flowing, you can query them in PostHog:",[198,1358,1359,1367,1374],{},[201,1360,211,1361,1364,1365],{},[213,1362,1363],{},"Events"," and filter by ",[154,1366,368],{},[201,1368,1369,1370,1373],{},"Use ",[213,1371,1372],{},"Insights"," to build dashboards on your wide event properties",[201,1375,1376,1377,1380],{},"Create ",[213,1378,1379],{},"Cohorts"," based on server-side behavior (e.g., users who triggered errors)",[129,1382,1383],{},"Example queries you can build:",[1385,1386,1387,1397,1403],"ul",{},[201,1388,1389,1390,1393,1394,229],{},"Error rate by endpoint (",[154,1391,1392],{},"properties.path",", ",[154,1395,1396],{},"properties.level = error",[201,1398,1399,1400,229],{},"Slow requests over time (",[154,1401,1402],{},"properties.duration > 1000",[201,1404,1405,1406,229],{},"Request volume by service (",[154,1407,986],{},[139,1409,1411],{"id":1410},"troubleshooting","Troubleshooting",[193,1413,1415],{"id":1414},"missing-apikey-error","Missing apiKey error",[146,1417,1422],{"className":1418,"code":1420,"language":1421},[1419],"language-text","[evlog/posthog] Missing apiKey. Set NUXT_POSTHOG_API_KEY/POSTHOG_API_KEY env var or pass to createPostHogDrain()\n","text",[154,1423,1420],{"__ignoreMap":152},[129,1425,1426],{},"Make sure your environment variable is set and the server was restarted after adding it.",[193,1428,1430],{"id":1429},"events-not-appearing","Events not appearing",[129,1432,1433],{},"PostHog processes events asynchronously. There may be a short delay (typically under 1 minute) before events appear in the dashboard.",[198,1435,1436,1443,1448],{},[201,1437,1438,1439,1442],{},"Check the server console for ",[154,1440,1441],{},"[evlog/posthog]"," error messages",[201,1444,1445,1446],{},"Verify your API key is correct and starts with ",[154,1447,228],{},[201,1449,1450,1451,1453],{},"Confirm your ",[154,1452,761],{}," matches your PostHog region (US vs EU)",[193,1455,1457],{"id":1456},"wrong-region","Wrong region",[129,1459,1460,1461,1463],{},"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,1462,1441],{},") to your server console. Set the correct host:",[146,1465,1467],{"className":236,"code":1466,"filename":238,"language":239,"meta":152,"style":152},"NUXT_POSTHOG_HOST=https://eu.i.posthog.com\n",[154,1468,1469],{"__ignoreMap":152},[157,1470,1471,1473,1475],{"class":159,"line":160},[157,1472,458],{"class":171},[157,1474,249],{"class":167},[157,1476,913],{"class":184},[139,1478,1480],{"id":1479},"direct-api-usage","Direct API Usage",[129,1482,1483],{},"For advanced use cases, you can use the lower-level functions:",[146,1485,1488],{"className":148,"code":1486,"filename":1487,"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,1489,1490,1519,1523,1528,1542,1558,1564,1568,1573,1586,1601,1608,1613,1619],{"__ignoreMap":152},[157,1491,1492,1494,1496,1499,1501,1504,1506,1509,1511,1513,1515,1517],{"class":159,"line":160},[157,1493,164],{"class":163},[157,1495,168],{"class":167},[157,1497,1498],{"class":171}," sendToPostHog",[157,1500,348],{"class":167},[157,1502,1503],{"class":171}," sendBatchToPostHog",[157,1505,348],{"class":167},[157,1507,1508],{"class":171}," toPostHogEvent",[157,1510,175],{"class":167},[157,1512,178],{"class":163},[157,1514,181],{"class":167},[157,1516,185],{"class":184},[157,1518,188],{"class":167},[157,1520,1521],{"class":159,"line":282},[157,1522,286],{"emptyLinePlaceholder":285},[157,1524,1525],{"class":159,"line":289},[157,1526,1527],{"class":536},"// Send a single event\n",[157,1529,1530,1533,1535,1538,1540],{"class":159,"line":320},[157,1531,1532],{"class":163},"await",[157,1534,1498],{"class":298},[157,1536,1537],{"class":171},"(event",[157,1539,348],{"class":167},[157,1541,317],{"class":167},[157,1543,1544,1547,1549,1551,1554,1556],{"class":159,"line":356},[157,1545,1546],{"class":337},"  apiKey",[157,1548,510],{"class":167},[157,1550,181],{"class":167},[157,1552,1553],{"class":184},"phc_xxx",[157,1555,340],{"class":167},[157,1557,669],{"class":167},[157,1559,1560,1562],{"class":159,"line":554},[157,1561,359],{"class":167},[157,1563,362],{"class":171},[157,1565,1566],{"class":159,"line":560},[157,1567,286],{"emptyLinePlaceholder":285},[157,1569,1570],{"class":159,"line":566},[157,1571,1572],{"class":536},"// Send multiple events in one request\n",[157,1574,1575,1577,1579,1582,1584],{"class":159,"line":709},[157,1576,1532],{"class":163},[157,1578,1503],{"class":298},[157,1580,1581],{"class":171},"(events",[157,1583,348],{"class":167},[157,1585,317],{"class":167},[157,1587,1589,1591,1593,1595,1597,1599],{"class":159,"line":1588},10,[157,1590,1546],{"class":337},[157,1592,510],{"class":167},[157,1594,181],{"class":167},[157,1596,1553],{"class":184},[157,1598,340],{"class":167},[157,1600,669],{"class":167},[157,1602,1604,1606],{"class":159,"line":1603},11,[157,1605,359],{"class":167},[157,1607,362],{"class":171},[157,1609,1611],{"class":159,"line":1610},12,[157,1612,286],{"emptyLinePlaceholder":285},[157,1614,1616],{"class":159,"line":1615},13,[157,1617,1618],{"class":536},"// Convert event to PostHog format (for inspection)\n",[157,1620,1622,1625,1628,1630,1632,1634,1636,1638,1641,1643,1645,1647,1649,1651],{"class":159,"line":1621},14,[157,1623,1624],{"class":313},"const",[157,1626,1627],{"class":171}," posthogEvent ",[157,1629,249],{"class":167},[157,1631,1508],{"class":298},[157,1633,1537],{"class":171},[157,1635,348],{"class":167},[157,1637,168],{"class":167},[157,1639,1640],{"class":337}," apiKey",[157,1642,510],{"class":167},[157,1644,181],{"class":167},[157,1646,1553],{"class":184},[157,1648,340],{"class":167},[157,1650,175],{"class":167},[157,1652,362],{"class":171},[139,1654,1656],{"id":1655},"next-steps","Next Steps",[1385,1658,1659,1665,1671,1676],{},[201,1660,1661,1664],{},[132,1662,1663],{"href":67},"Axiom Adapter"," - Send logs to Axiom",[201,1666,1667,1670],{},[132,1668,1669],{"href":72},"OTLP Adapter"," - Send logs via OpenTelemetry Protocol",[201,1672,1673,1675],{},[132,1674,91],{"href":92}," - Build your own adapter",[201,1677,1678,1680],{},[132,1679,46],{"href":47}," - Security and production tips",[1682,1683,1684],"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":152,"searchDepth":282,"depth":282,"links":1686},[1687,1688,1693,1699,1700,1704,1705,1710,1711],{"id":141,"depth":282,"text":15},{"id":191,"depth":282,"text":20,"children":1689},[1690,1691,1692],{"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":1694},[1695,1696,1697,1698],{"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":1701},[1702,1703],{"id":1020,"depth":289,"text":1021},{"id":1129,"depth":289,"text":1130},{"id":1352,"depth":282,"text":1353},{"id":1410,"depth":282,"text":1411,"children":1706},[1707,1708,1709],{"id":1414,"depth":289,"text":1415},{"id":1429,"depth":289,"text":1430},{"id":1456,"depth":289,"text":1457},{"id":1479,"depth":282,"text":1480},{"id":1655,"depth":282,"text":1656},"Send logs to PostHog as events for product analytics, session replay correlation, and wide event querying.","md",[1715,1721],{"label":1716,"icon":1717,"to":206,"target":1718,"color":1719,"variant":1720},"PostHog Dashboard","i-lucide-external-link","_blank","neutral","subtle",{"label":1663,"icon":69,"to":67,"color":1719,"variant":1720},{},{"title":76,"icon":79},{"title":124,"description":1712},"B4DQr0cL-fxEw2xSABg-U_yPo7dzAyFjJnv0Hksae10",[1727,1729],{"title":71,"path":72,"stem":73,"description":1728,"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":1730,"icon":84,"children":-1},"Send structured logs to Sentry Logs for high-cardinality querying and debugging. Zero-config setup with environment variables.",1771085447383]