{"title":"PostHog","description":"Forward events from an existing PostHog JavaScript integration into Altertable Product Analytics without changing tracking calls.","order":325,"askSuggestions":["Can I keep my PostHog tracking calls as they are?","Why are my Altertable track calls ignored with PostHog?"],"navigation":true,"body":{"code":"var Component=(()=>{var g=Object.create;var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var P=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports),b=(o,e)=>{for(var n in e)i(o,n,{get:e[n],enumerable:!0})},a=(o,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let c of f(e))!y.call(o,c)&&c!==n&&i(o,c,{get:()=>e[c],enumerable:!(r=u(e,c))||r.enumerable});return o};var k=(o,e,n)=>(n=o!=null?g(m(o)):{},a(e||!o||!o.__esModule?i(n,\"default\",{value:o,enumerable:!0}):n,o)),v=o=>a(i({},\"__esModule\",{value:!0}),o);var l=P((A,s)=>{s.exports=_jsx_runtime});var x={};b(x,{default:()=>p,frontmatter:()=>w});var t=k(l()),w={title:\"PostHog\",description:\"Forward events from an existing PostHog JavaScript integration into Altertable Product Analytics without changing tracking calls.\",order:325,askSuggestions:[\"Can I keep my PostHog tracking calls as they are?\",\"Why are my Altertable track calls ignored with PostHog?\"]};function d(o){let e={a:\"a\",code:\"code\",h1:\"h1\",h2:\"h2\",p:\"p\",pre:\"pre\",...o.components},{DocsPreviewDocument:n,DocsPreviewSection:r}=e;return n||h(\"DocsPreviewDocument\",!0),r||h(\"DocsPreviewSection\",!0),(0,t.jsxs)(n,{anchors:\"posthog connect-posthog\",children:[(0,t.jsxs)(r,{sectionId:\"posthog\",sectionTitle:\"PostHog\",anchors:\"\",ancestors:\"\",index:\"0\",children:[(0,t.jsx)(e.h1,{id:\"posthog\",children:\"PostHog\"}),`\n`,(0,t.jsxs)(e.p,{children:[\"If your application already tracks events with PostHog, the Altertable JavaScript SDK can forward those captured events into the \",(0,t.jsx)(e.code,{children:\"product_analytics\"}),\" catalog. Your existing PostHog tracking calls can stay in place.\"]}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"connect-posthog\",sectionTitle:\"Connect PostHog\",anchors:\"\",ancestors:\"\",index:\"1\",children:[(0,t.jsx)(e.h2,{id:\"connect-posthog\",children:\"Connect PostHog\"}),`\n`,(0,t.jsxs)(e.p,{children:[\"Enable \",(0,t.jsx)(e.a,{href:\"/docs/product-analytics\",children:\"Product Analytics\"}),\" and copy its \",(0,t.jsx)(e.a,{href:\"/docs/product-analytics/authentication\",children:\"API key\"}),\". Initialize Altertable before PostHog:\"]}),`\n`,(0,t.jsx)(e.pre,{children:(0,t.jsx)(e.code,{className:\"language-typescript\",children:`import posthog from 'posthog-js';\nimport { altertable } from '@altertable/altertable-js';\n\naltertable.init('{{API_KEY}}', {\n  adapters: { posthog },\n});\n\nposthog.init('POSTHOG_KEY');\n`})}),`\n`,(0,t.jsxs)(e.p,{children:[\"While the adapter is configured, Altertable's own \",(0,t.jsx)(e.code,{children:\"track\"}),\", \",(0,t.jsx)(e.code,{children:\"page\"}),\", \",(0,t.jsx)(e.code,{children:\"identify\"}),\", \",(0,t.jsx)(e.code,{children:\"alias\"}),\", \",(0,t.jsx)(e.code,{children:\"updateTraits\"}),\", and \",(0,t.jsx)(e.code,{children:\"reset\"}),\" calls are ignored, and its automatic capture stays off. Altertable still applies its tracking consent setting. Forwarded events do not pass through \",(0,t.jsx)(e.code,{children:\"transformEvent\"}),\".\"]}),`\n`,(0,t.jsx)(e.p,{children:\"PostHog events need a distinct ID and timestamp. Cookieless PostHog events are not supported.\"}),`\n`,(0,t.jsxs)(e.p,{children:[\"For events tracked directly with Altertable, see \",(0,t.jsx)(e.a,{href:\"/docs/product-analytics/track\",children:\"Track\"}),\".\"]})]})]})}function p(o={}){let{wrapper:e}=o.components||{};return e?(0,t.jsx)(e,{...o,children:(0,t.jsx)(d,{...o})}):d(o)}function h(o,e){throw new Error(\"Expected \"+(e?\"component\":\"object\")+\" `\"+o+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return v(x);})();\n;return Component;"},"_id":"docs/lakehouse/ingest/integrations/posthog.mdx","_raw":{"sourceFilePath":"docs/lakehouse/ingest/integrations/posthog.mdx","sourceFileName":"posthog.mdx","sourceFileDir":"docs/lakehouse/ingest/integrations","contentType":"mdx","flattenedPath":"docs/lakehouse/ingest/integrations/posthog"},"type":"Docs","path":"/lakehouse/ingest/integrations/posthog","level":4,"parent":"lakehouse/ingest/integrations"}