(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5710],{42711:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/implementation/guides/avo-and-existing-tracking",function(){return t(77764)}])},77764:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return c},useTOC:function(){return l}});var i=t(85893),a=t(37812),r=t(20331),o=t(38925),s={src:"/docs/_next/static/media/implement-with-avo-example.6e7f61eb.png",height:718,width:1386,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAMAAACEE47CAAAACVBMVEX8/f319vbu7u/gdDvBAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAHElEQVR4nGNgZGKAAEYmJkZGRkYQgxEmBMKMjAABqgAVAjyeHQAAAABJRU5ErkJggg==",blurWidth:8,blurHeight:4};function l(e){return[{value:"1. Start implementing all new tracking with Codegen.",id:"1-start-implementing-all-new-tracking-with-codegen",depth:3},{value:"2. Migrate you existing implementation to Avo",id:"2-migrate-you-existing-implementation-to-avo",depth:3}]}var c=(0,a.c)(function(e){let{toc:n=l(e)}=e,t={a:"a",code:"code",h1:"h1",h3:"h3",img:"img",li:"li",p:"p",pre:"pre",span:"span",ul:"ul",...(0,o.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h1,{children:"Avo Codegen alongside existing tracking"}),"\n",(0,i.jsx)(t.p,{children:"You can safely keep raw tracking calls in your code when adopting Codegen. In this case we recommend to migrate gradually, following 2 steps below."}),"\n",(0,i.jsx)(t.h3,{id:n[0].id,children:n[0].value}),"\n",(0,i.jsx)(t.p,{children:"Mark the new events you want to implement with Avo Codegen as “Implement with Codegen” in the Avo workspace and they will appear as functions in the generated code."}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsx)(t.img,{alt:"Implement with Codegen checkbox example",placeholder:"blur",src:s})}),"\n",(0,i.jsxs)(t.p,{children:["Initiate Codegen with a ",(0,i.jsx)(t.a,{href:"/implementation/destinations#destination-interface-callback-methods",children:"destination interface"}),"."]}),"\n",(0,i.jsx)(t.p,{children:"In the track methods of the destination interface (logEvent, identify etc.) you use your existing tracking SDK instance to track events:"}),"\n",(0,i.jsx)(t.pre,{tabIndex:"0","data-language":"pseudocode","data-word-wrap":"","data-copy":"",children:(0,i.jsxs)(t.code,{children:[(0,i.jsx)(t.span,{children:(0,i.jsx)(t.span,{children:"logEvent(eventName, eventProperties) {"})}),"\n",(0,i.jsx)(t.span,{children:(0,i.jsx)(t.span,{children:"    // Log event in your destination"})}),"\n",(0,i.jsx)(t.span,{children:(0,i.jsx)(t.span,{children:"    analytics.track(eventName, eventProperties)"})}),"\n",(0,i.jsx)(t.span,{children:(0,i.jsx)(t.span,{children:"}"})})]})}),"\n",(0,i.jsx)(t.p,{children:"With this one time setup the events you track with Codegen will be sent to the same analytics destinations as your existing events."}),"\n",(0,i.jsx)(t.h3,{id:n[1].id,children:n[1].value}),"\n",(0,i.jsx)(t.p,{children:"Going forward you’ll be able to gradually swap old events implemented with raw analytics SDK with Avo implementation at your own pace by:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Marking more events as “Implement with Codegen”"}),"\n",(0,i.jsx)(t.li,{children:"Pulling the Avo code"}),"\n",(0,i.jsx)(t.li,{children:"Replacing existing SDK calls with calls of the generated Codegen"}),"\n"]})]})},"/implementation/guides/avo-and-existing-tracking",{filePath:"pages/implementation/guides/avo-and-existing-tracking.mdx",timestamp:1729251446e3,pageMap:r.v,frontMatter:{},title:"Avo Codegen alongside existing tracking"},"undefined"==typeof RemoteContent?l:RemoteContent.useTOC)},38925:function(e,n,t){"use strict";t.d(n,{a:function(){return l}});var i=t(11151),a=t(25675),r=t.n(a),o=t(67294);let s={img:e=>(0,o.createElement)("object"==typeof e.src?r():"img",e)},l=e=>(0,i.a)({...s,...e})},37812:function(e,n,t){"use strict";t.d(n,{c:function(){return c}});var i=t(85893),a=t(3665),r=t(48644);let o=(0,t(67294).createContext)({}),s=o.Provider;o.displayName="SSG";var l=t(38925);function c(e,n,t,i){let r=globalThis[a.ud];return r.route=n,r.pageMap=t.pageMap,r.context[n]={Content:e,pageOpts:t,useTOC:i},d}function d({__nextra_pageMap:e=[],__nextra_dynamic_opts:n,...t}){let o=globalThis[a.ud],{Layout:l,themeConfig:c}=o,{route:d,locale:g}=(0,r.t)(),u=o.context[d];if(!u)throw Error(`No content found for the "${d}" route. Please report it as a bug.`);let{pageOpts:p,useTOC:m,Content:x}=u;if(d.startsWith("/["))p.pageMap=e;else for(let{route:n,children:t}of e){let e=n.split("/").slice(g?2:1);(function e(n,[t,...i]){for(let a of n)if("children"in a&&t===a.name)return i.length?e(a.children,i):a})(p.pageMap,e).children=t}if(n){let{title:e,frontMatter:t}=n;p={...p,title:e,frontMatter:t}}return(0,i.jsx)(l,{themeConfig:c,pageOpts:p,pageProps:t,children:(0,i.jsx)(s,{value:t,children:(0,i.jsx)(h,{useTOC:m,children:(0,i.jsx)(x,{...t})})})})}function h({children:e,useTOC:n}){let{wrapper:t}=(0,l.a)();return(0,i.jsx)(g,{useTOC:n,wrapper:t,children:e})}function g({children:e,useTOC:n,wrapper:t,...a}){let r=n(a);return t?(0,i.jsx)(t,{toc:r,children:e}):e}}},function(e){e.O(0,[331,2888,9774,179],function(){return e(e.s=42711)}),_N_E=e.O()}]);