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