{"title":"Alias","description":"Alias product analytics identifiers in Altertable to merge user profiles when identity systems or user IDs change.","order":400,"askSuggestions":["When should I use alias instead of identify?","How do I keep history when moving to a new user ID format?"],"navigation":true,"body":{"code":"var Component=(()=>{var u=Object.create;var o=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var x=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),w=(i,e)=>{for(var s in e)o(i,s,{get:e[s],enumerable:!0})},a=(i,e,s,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let t of m(e))!g.call(i,t)&&t!==s&&o(i,t,{get:()=>e[t],enumerable:!(r=f(e,t))||r.enumerable});return i};var D=(i,e,s)=>(s=i!=null?u(y(i)):{},a(e||!i||!i.__esModule?o(s,\"default\",{value:i,enumerable:!0}):s,i)),I=i=>a(o({},\"__esModule\",{value:!0}),i);var d=x((v,l)=>{l.exports=_jsx_runtime});var S={};w(S,{default:()=>p,frontmatter:()=>k});var n=D(d()),k={title:\"Alias\",description:\"Alias product analytics identifiers in Altertable to merge user profiles when identity systems or user IDs change.\",order:400,askSuggestions:[\"When should I use alias instead of identify?\",\"How do I keep history when moving to a new user ID format?\"]};function h(i){let e={a:\"a\",code:\"code\",h1:\"h1\",h2:\"h2\",li:\"li\",p:\"p\",strong:\"strong\",ul:\"ul\",...i.components},{DocsPreviewDocument:s,DocsPreviewSection:r,DocsSdkSnippetTabs:t}=e;return s||c(\"DocsPreviewDocument\",!0),r||c(\"DocsPreviewSection\",!0),t||c(\"DocsSdkSnippetTabs\",!0),(0,n.jsxs)(s,{anchors:\"alias-users when-to-call-it sdk-examples api-reference best-practices\",children:[(0,n.jsxs)(r,{sectionId:\"alias-users\",anchors:\"\",ancestors:\"\",index:\"0\",children:[(0,n.jsx)(e.h1,{id:\"alias-users\",children:\"Alias Users\"}),`\n`,(0,n.jsxs)(e.p,{children:[\"Use \",(0,n.jsx)(e.code,{children:\"alias\"}),\" to explicitly link two existing identifiers to the same user profile.\"]}),`\n`,(0,n.jsxs)(e.p,{children:[\"Most teams do \",(0,n.jsx)(e.strong,{children:\"not\"}),\" need \",(0,n.jsx)(e.code,{children:\"alias()\"}),\" for normal sign-up or login flows. In the common case, \",(0,n.jsx)(e.a,{href:\"/docs/product-analytics/identify\",children:(0,n.jsx)(e.code,{children:\"identify()\"})}),\" is enough.\"]}),`\n`]}),(0,n.jsxs)(r,{sectionId:\"when-to-call-it\",anchors:\"\",ancestors:\"\",index:\"1\",children:[(0,n.jsx)(e.h2,{id:\"when-to-call-it\",children:\"When to call it\"}),`\n`,(0,n.jsxs)(e.p,{children:[\"Use \",(0,n.jsx)(e.code,{children:\"alias()\"}),\" when you are intentionally merging identifiers, such as:\"]}),`\n`,(0,n.jsxs)(e.ul,{children:[`\n`,(0,n.jsx)(e.li,{children:\"a legacy ID and a new ID format\"}),`\n`,(0,n.jsx)(e.li,{children:\"an external system identifier and your internal user ID\"}),`\n`,(0,n.jsx)(e.li,{children:\"two known profiles that should resolve to one person\"}),`\n`]}),`\n`]}),(0,n.jsxs)(r,{sectionId:\"sdk-examples\",anchors:\"\",ancestors:\"\",index:\"2\",children:[(0,n.jsx)(e.h2,{id:\"sdk-examples\",children:\"SDK examples\"}),`\n`,(0,n.jsx)(e.p,{children:\"When transitioning to a new ID format, alias the new ID to preserve historical data:\"}),`\n`,(0,n.jsx)(t,{snippetId:\"alias-migration\"}),`\n`]}),(0,n.jsxs)(r,{sectionId:\"api-reference\",anchors:\"\",ancestors:\"\",index:\"3\",children:[(0,n.jsx)(e.h2,{id:\"api-reference\",children:\"API reference\"}),`\n`,(0,n.jsxs)(e.p,{children:[\"For HTTP request details, response shape, and error codes, see \",(0,n.jsx)(e.a,{href:\"/docs/api-references/product-analytics#post-alias\",children:(0,n.jsx)(e.code,{children:\"POST /alias\"})}),\".\"]}),`\n`]}),(0,n.jsxs)(r,{sectionId:\"best-practices\",anchors:\"\",ancestors:\"\",index:\"4\",children:[(0,n.jsx)(e.h2,{id:\"best-practices\",children:\"Best practices\"}),`\n`,(0,n.jsxs)(e.ul,{children:[`\n`,(0,n.jsx)(e.li,{children:\"Use aliasing sparingly and only for meaningful identity merges.\"}),`\n`,(0,n.jsxs)(e.li,{children:[\"Pick one canonical \",(0,n.jsx)(e.code,{children:\"distinct_id\"}),\" and alias secondary IDs to it.\"]}),`\n`,(0,n.jsxs)(e.li,{children:[\"Add source prefixes to alias IDs, such as \",(0,n.jsx)(e.code,{children:\"stripe:\"}),\", \",(0,n.jsx)(e.code,{children:\"crm:\"}),\", or \",(0,n.jsx)(e.code,{children:\"legacy:\"}),\".\"]}),`\n`,(0,n.jsx)(e.li,{children:\"Link aliases directly to the primary user ID, not to each other.\"}),`\n`]})]})]})}function p(i={}){let{wrapper:e}=i.components||{};return e?(0,n.jsx)(e,{...i,children:(0,n.jsx)(h,{...i})}):h(i)}function c(i,e){throw new Error(\"Expected \"+(e?\"component\":\"object\")+\" `\"+i+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return I(S);})();\n;return Component;"},"_id":"docs/product-analytics/alias.mdx","_raw":{"sourceFilePath":"docs/product-analytics/alias.mdx","sourceFileName":"alias.mdx","sourceFileDir":"docs/product-analytics","contentType":"mdx","flattenedPath":"docs/product-analytics/alias"},"type":"Docs","path":"/product-analytics/alias","level":2,"parent":"product-analytics"}