{"title":"Track your first product event","description":"Enable Product Analytics, send a test event with an API key, and verify it in the lakehouse before instrumenting your application with an SDK.","order":300,"askSuggestions":["How do I install an SDK in my application?","Why doesn't my test event appear in the events table?","How do I link anonymous activity to a signed-in user?"],"navigation":true,"routeId":"gettingStartedProductAnalytics","body":{"code":"var Component=(()=>{var y=Object.create;var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),b=(t,e)=>{for(var i in e)a(t,i,{get:e[i],enumerable:!0})},d=(t,e,i,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of v(e))!g.call(t,o)&&o!==i&&a(t,o,{get:()=>e[o],enumerable:!(r=m(e,o))||r.enumerable});return t};var w=(t,e,i)=>(i=t!=null?y(f(t)):{},d(e||!t||!t.__esModule?a(i,\"default\",{value:t,enumerable:!0}):i,t)),A=t=>d(a({},\"__esModule\",{value:!0}),t);var h=P((D,l)=>{l.exports=_jsx_runtime});var k={};b(k,{default:()=>p,frontmatter:()=>I});var n=w(h()),I={title:\"Track your first product event\",routeId:\"gettingStartedProductAnalytics\",description:\"Enable Product Analytics, send a test event with an API key, and verify it in the lakehouse before instrumenting your application with an SDK.\",order:300,askSuggestions:[\"How do I install an SDK in my application?\",\"Why doesn't my test event appear in the events table?\",\"How do I link anonymous activity to a signed-in user?\"]};function u(t){let e={a:\"a\",code:\"code\",h1:\"h1\",h2:\"h2\",p:\"p\",pre:\"pre\",strong:\"strong\",...t.components},{DocsPreviewDocument:i,DocsPreviewSection:r,DocsPrompt:o,DocsPrompts:c}=e;return i||s(\"DocsPreviewDocument\",!0),r||s(\"DocsPreviewSection\",!0),o||s(\"DocsPrompt\",!0),c||s(\"DocsPrompts\",!0),(0,n.jsxs)(i,{anchors:\"track-your-first-product-event 1-enable-product-analytics 2-send-an-event 3-find-the-event do-this-with-your-agent\",children:[(0,n.jsxs)(r,{sectionId:\"track-your-first-product-event\",anchors:\"\",ancestors:\"\",index:\"0\",children:[(0,n.jsx)(e.h1,{id:\"track-your-first-product-event\",children:\"Track your first product event\"}),`\n`,(0,n.jsx)(e.p,{children:\"Send one event and verify it before instrumenting your application.\"}),`\n`]}),(0,n.jsxs)(r,{sectionId:\"1-enable-product-analytics\",anchors:\"\",ancestors:\"\",index:\"1\",children:[(0,n.jsx)(e.h2,{id:\"1-enable-product-analytics\",children:\"1. Enable Product Analytics\"}),`\n`,(0,n.jsxs)(e.p,{children:[\"In \",(0,n.jsx)(e.strong,{children:\"Catalogs\"}),\", choose \",(0,n.jsx)(e.strong,{children:\"New Catalog\"}),\" and enable \",(0,n.jsx)(e.strong,{children:\"Product Analytics\"}),\" in your environment. Create or copy a \",(0,n.jsx)(e.a,{href:\"/docs/product-analytics/authentication\",children:\"Product Analytics API key\"}),\".\"]}),`\n`,(0,n.jsx)(e.p,{children:\"Product Analytics uses its own API key. MCP authorization and lakehouse credentials do not replace it.\"}),`\n`]}),(0,n.jsxs)(r,{sectionId:\"2-send-an-event\",anchors:\"\",ancestors:\"\",index:\"2\",children:[(0,n.jsx)(e.h2,{id:\"2-send-an-event\",children:\"2. Send an event\"}),`\n`,(0,n.jsx)(e.p,{children:\"Set the API key for the target environment. The key selects the environment:\"}),`\n`,(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:\"language-bash\",children:`ALTERTABLE_API_KEY='{{API_KEY}}'\ncurl https://api.altertable.ai/track \\\\\n  -H \"X-API-Key: $ALTERTABLE_API_KEY\" \\\\\n  -H 'Content-Type: application/json' \\\\\n  -d '{\"event\":\"Onboarding Test\",\"properties\":{},\"distinct_id\":\"onboarding_test_user\"}'\n`})}),`\n`]}),(0,n.jsxs)(r,{sectionId:\"3-find-the-event\",anchors:\"\",ancestors:\"\",index:\"3\",children:[(0,n.jsx)(e.h2,{id:\"3-find-the-event\",children:\"3. Find the event\"}),`\n`,(0,n.jsxs)(e.p,{children:[\"Run this in \",(0,n.jsx)(e.a,{href:\"/docs/lakehouse/query/sql-explorer\",children:\"SQL Explorer\"}),\":\"]}),`\n`,(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:\"language-sql\",children:`SELECT event, distinct_id, timestamp\nFROM product_analytics.main.events\nWHERE event = 'Onboarding Test'\nORDER BY timestamp DESC\nLIMIT 10;\n`})}),`\n`,(0,n.jsxs)(e.p,{children:[\"Confirm that the event belongs to \",(0,n.jsx)(e.code,{children:\"onboarding_test_user\"}),\" and has a recent timestamp.\"]}),`\n`]}),(0,n.jsxs)(r,{sectionId:\"do-this-with-your-agent\",anchors:\"\",ancestors:\"\",index:\"4\",children:[(0,n.jsx)(e.h2,{id:\"do-this-with-your-agent\",children:\"Do this with your agent\"}),`\n`,(0,n.jsx)(c,{children:(0,n.jsx)(o,{children:\"Read https://altertable.ai/docs/product-analytics/setup.md. Set up Product Analytics for this application. Inspect the framework, existing analytics, authentication, and consent handling. Ask which completed action I want to measure and confirm the target environment. Reuse a supported SDK and propose one event with a stable test identity. Keep the environment's Product Analytics key outside source control. Verify the event with a bounded query by its name and test identity, including its properties and timestamp.\"})}),`\n`,(0,n.jsxs)(e.p,{children:[\"Next, \",(0,n.jsx)(e.a,{href:\"/docs/product-analytics/setup\",children:\"install an SDK in your application\"}),\" to send real events.\"]})]})]})}function p(t={}){let{wrapper:e}=t.components||{};return e?(0,n.jsx)(e,{...t,children:(0,n.jsx)(u,{...t})}):u(t)}function s(t,e){throw new Error(\"Expected \"+(e?\"component\":\"object\")+\" `\"+t+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return A(k);})();\n;return Component;"},"_id":"docs/getting-started/product-analytics.mdx","_raw":{"sourceFilePath":"docs/getting-started/product-analytics.mdx","sourceFileName":"product-analytics.mdx","sourceFileDir":"docs/getting-started","contentType":"mdx","flattenedPath":"docs/getting-started/product-analytics"},"type":"Docs","path":"/getting-started/product-analytics","level":2,"parent":"getting-started"}