CINXE.COM
JQL: Create custom queries using Javascript code - Mixpanel Docs
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover"/><style>:root{--nextra-primary-hue:212deg;--nextra-primary-saturation:100%;--nextra-navbar-height:64px;--nextra-menu-height:3.75rem;--nextra-banner-height:2.5rem;--nextra-bg:250,250,250;}.dark{--nextra-primary-hue:204deg;--nextra-primary-saturation:100%;--nextra-bg:17,17,17;}</style><title>JQL: Create custom queries using Javascript code - Mixpanel Docs</title><meta property="og:url" content="https://docs.mixpanel.com/docs/reports/apps/jql"/><meta property="og:title" content="JQL: Create custom queries using Javascript code - Mixpanel Docs"/><meta property="og:description" content="Read more about Mixpanel documentation"/><link rel="apple-touch-icon" sizes="180x180" href="https://cdn.mxpnl.com/marketing-site/static/favicons/apple-touch-icon.png"/><link rel="icon" sizes="16x16" href="https://cdn.mxpnl.com/marketing-site/static/favicons/favicon-16x16.png" type="image/png"/><link rel="icon" sizes="32x32" href="https://cdn.mxpnl.com/marketing-site/static/favicons/favicon-32x32.png" type="image/png"/><link rel="mask-icon" href="https://cdn.mxpnl.com/marketing-site/static/favicons/safari-pinned-tab.svg" color="#7856ff"/><meta name="msapplication-TileColor" content="#ffffff"/><meta name="theme-color" content="#ffffff"/><meta name="next-head-count" content="13"/><link data-next-font="" rel="preconnect" href="/" crossorigin="anonymous"/><script type="text/javascript" id="load-rollbar-script" data-nscript="beforeInteractive"> var _rollbarConfig = { accessToken: 'ded7586aab784bd2917c499af1e0d51f', captureUncaught: true, captureUnhandledRejections: true, enabled: true, ignoredMessages: ['Security Policy Violation'], payload: { environment: 'production', repo: 'docs' } }; // Rollbar Snippet !function(r){var e={};function o(n){if(e[n])return e[n].exports;var t=e[n]={i:n,l:!1,exports:{}};return r[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=r,o.c=e,o.d=function(r,e,n){o.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},o.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},o.t=function(r,e){if(1&e&&(r=o(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var t in r)o.d(n,t,function(e){return r[e]}.bind(null,t));return n},o.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return o.d(e,"a",e),e},o.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},o.p="",o(o.s=0)}([function(r,e,o){"use strict";var n=o(1),t=o(5);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdn.rollbar.com/rollbarjs/refs/tags/v2.26.1/rollbar.min.js",_rollbarConfig.async=void 0===_rollbarConfig.async||_rollbarConfig.async;var a=n.setupShim(window,_rollbarConfig),l=t(_rollbarConfig);window.rollbar=n.Rollbar,a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,l)},function(r,e,o){"use strict";var n=o(2),t=o(3);function a(r){return function(){try{return r.apply(this,arguments)}catch(r){try{console.error("[Rollbar]: Internal error",r)}catch(r){}}}}var l=0;function i(r,e){this.options=r,this._rollbarOldOnError=null;var o=l++;this.shimId=function(){return o},"undefined"!=typeof window&&window._rollbarShims&&(window._rollbarShims[o]={handler:e,messages:[]})}var s=o(4),d=function(r,e){return new i(r,e)},c=function(r){return new s(d,r)};function u(r){return a((function(){var e=this,o=Array.prototype.slice.call(arguments,0),n={shim:e,method:r,args:o,ts:new Date};window._rollbarShims[this.shimId()].messages.push(n)}))}i.prototype.loadFull=function(r,e,o,n,t){var l=!1,i=e.createElement("script"),s=e.getElementsByTagName("script")[0],d=s.parentNode;i.crossOrigin="",i.src=n.rollbarJsUrl,o||(i.async=!0),i.onload=i.onreadystatechange=a((function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){i.onload=i.onreadystatechange=null;try{d.removeChild(i)}catch(r){}l=!0,function(){var e;if(void 0===r._rollbarDidLoad){e=new Error("rollbar.js did not load");for(var o,n,a,l,i=0;o=r._rollbarShims[i++];)for(o=o.messages||[];n=o.shift();)for(a=n.args||[],i=0;i<a.length;++i)if("function"==typeof(l=a[i])){l(e);break}}"function"==typeof t&&t(e)}()}})),d.insertBefore(i,s)},i.prototype.wrap=function(r,e,o){try{var n;if(n="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._rollbar_wrapped&&(r._rollbar_wrapped=function(){o&&"function"==typeof o&&o.apply(this,arguments);try{return r.apply(this,arguments)}catch(o){var e=o;throw e&&("string"==typeof e&&(e=new String(e)),e._rollbarContext=n()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e),e}},r._rollbar_wrapped._isWrap=!0,r.hasOwnProperty))for(var t in r)r.hasOwnProperty(t)&&(r._rollbar_wrapped[t]=r[t]);return r._rollbar_wrapped}catch(e){return r}};for(var p="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad".split(","),f=0;f<p.length;++f)i.prototype[p[f]]=u(p[f]);r.exports={setupShim:function(r,e){if(r){var o=e.globalAlias||"Rollbar";if("object"==typeof r[o])return r[o];r._rollbarShims={},r._rollbarWrappedError=null;var l=new c(e);return a((function(){e.captureUncaught&&(l._rollbarOldOnError=r.onerror,n.captureUncaughtExceptions(r,l,!0),e.wrapGlobalEventHandlers&&t(r,l,!0)),e.captureUnhandledRejections&&n.captureUnhandledRejections(r,l,!0);var a=e.autoInstrument;return!1!==e.enabled&&(void 0===a||!0===a||function(r){return!("object"!=typeof r||void 0!==r.page&&!r.page)}(a))&&r.addEventListener&&(r.addEventListener("load",l.captureLoad.bind(l)),r.addEventListener("DOMContentLoaded",l.captureDomContentLoaded.bind(l))),r[o]=l,l}))()}},Rollbar:c}},function(r,e,o){"use strict";function n(r,e,o,n){r._rollbarWrappedError&&(n[4]||(n[4]=r._rollbarWrappedError),n[5]||(n[5]=r._rollbarWrappedError._rollbarContext),r._rollbarWrappedError=null);var t=e.handleUncaughtException.apply(e,n);o&&o.apply(r,n),"anonymous"===t&&(e.anonymousErrorsPending+=1)}r.exports={captureUncaughtExceptions:function(r,e,o){if(r){var t;if("function"==typeof e._rollbarOldOnError)t=e._rollbarOldOnError;else if(r.onerror){for(t=r.onerror;t._rollbarOldOnError;)t=t._rollbarOldOnError;e._rollbarOldOnError=t}e.handleAnonymousErrors();var a=function(){var o=Array.prototype.slice.call(arguments,0);n(r,e,t,o)};o&&(a._rollbarOldOnError=t),r.onerror=a}},captureUnhandledRejections:function(r,e,o){if(r){"function"==typeof r._rollbarURH&&r._rollbarURH.belongsToShim&&r.removeEventListener("unhandledrejection",r._rollbarURH);var n=function(r){var o,n,t;try{o=r.reason}catch(r){o=void 0}try{n=r.promise}catch(r){n="[unhandledrejection] error getting `promise` from event"}try{t=r.detail,!o&&t&&(o=t.reason,n=t.promise)}catch(r){}o||(o="[unhandledrejection] error getting `reason` from event"),e&&e.handleUnhandledRejection&&e.handleUnhandledRejection(o,n)};n.belongsToShim=o,r._rollbarURH=n,r.addEventListener("unhandledrejection",n)}}}},function(r,e,o){"use strict";function n(r,e,o){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){for(var n=e.addEventListener;n._rollbarOldAdd&&n.belongsToShim;)n=n._rollbarOldAdd;var t=function(e,o,t){n.call(this,e,r.wrap(o),t)};t._rollbarOldAdd=n,t.belongsToShim=o,e.addEventListener=t;for(var a=e.removeEventListener;a._rollbarOldRemove&&a.belongsToShim;)a=a._rollbarOldRemove;var l=function(r,e,o){a.call(this,r,e&&e._rollbar_wrapped||e,o)};l._rollbarOldRemove=a,l.belongsToShim=o,e.removeEventListener=l}}r.exports=function(r,e,o){if(r){var t,a,l="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(t=0;t<l.length;++t)r[a=l[t]]&&r[a].prototype&&n(e,r[a].prototype,o)}}},function(r,e,o){"use strict";function n(r,e){this.impl=r(e,this),this.options=e,function(r){for(var e=function(r){return function(){var e=Array.prototype.slice.call(arguments,0);if(this.impl[r])return this.impl[r].apply(this.impl,e)}},o="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,_createItem,wrap,loadFull,shimId,captureEvent,captureDomContentLoaded,captureLoad".split(","),n=0;n<o.length;n++)r[o[n]]=e(o[n])}(n.prototype)}n.prototype._swapAndProcessMessages=function(r,e){var o,n,t;for(this.impl=r(this.options);o=e.shift();)n=o.method,t=o.args,this[n]&&"function"==typeof this[n]&&("captureDomContentLoaded"===n||"captureLoad"===n?this[n].apply(this,[t[0],o.ts]):this[n].apply(this,t));return this},r.exports=n},function(r,e,o){"use strict";r.exports=function(r){return function(e){if(!e&&!window._rollbarInitialized){for(var o,n,t=(r=r||{}).globalAlias||"Rollbar",a=window.rollbar,l=function(r){return new a(r)},i=0;o=window._rollbarShims[i++];)n||(n=o.handler),o.handler._swapAndProcessMessages(l,o.messages);window[t]=n,window._rollbarInitialized=!0}}}}]); // End Rollbar Snippet</script><link rel="preload" href="/_next/static/css/86793a411606dc1b.css" as="style"/><link rel="stylesheet" href="/_next/static/css/86793a411606dc1b.css" data-n-g=""/><link rel="preload" href="/_next/static/css/0f2b664b81cf4e48.css" as="style"/><link rel="stylesheet" href="/_next/static/css/0f2b664b81cf4e48.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-7958faef4b591819.js" defer=""></script><script src="/_next/static/chunks/framework-945b357d4a851f4b.js" defer=""></script><script src="/_next/static/chunks/main-f30a30409e1c6ab4.js" defer=""></script><script src="/_next/static/chunks/pages/_app-33f7b8c665b03346.js" defer=""></script><script src="/_next/static/chunks/854-6e663c7313843866.js" defer=""></script><script src="/_next/static/chunks/pages/docs/reports/apps/jql-021435b16099c9f5.js" defer=""></script><script src="/_next/static/61ktskimPr4Fk1_DjRZix/_buildManifest.js" defer=""></script><script src="/_next/static/61ktskimPr4Fk1_DjRZix/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div class="nx-bg-lightbg dark:nx-bg-darkbg"><script>!function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');var e=localStorage.getItem('theme');if('system'===e||(!e&&true)){var t='(prefers-color-scheme: dark)',m=window.matchMedia(t);if(m.media!==t||m.matches){d.style.colorScheme = 'dark';c.add('dark')}else{d.style.colorScheme = 'light';c.add('light')}}else if(e){c.add(e|| '')}if(e==='light'||e==='dark')d.style.colorScheme=e}catch(e){}}()</script><div dir="ltr"><script>document.documentElement.setAttribute('dir','ltr')</script><div class="nextra-nav-container _sticky _top-0 _z-20 _w-full _bg-transparent print:_hidden"><div class="nextra-nav-container-blur"></div><nav class="_mx-auto _flex _h-[var(--nextra-navbar-height)] _max-w-[90rem] _items-center _justify-end _gap-4 _pl-[max(env(safe-area-inset-left),1.5rem)] _pr-[max(env(safe-area-inset-right),1.5rem)]"><a class="nextra-focus _flex _items-center hover:_opacity-75 ltr:_mr-auto rtl:_ml-auto" href="https://mixpanel.com/home/"><svg style="width:125px;height:auto" viewBox="0 0 798 189" fill="None" xmlns="http://www.w3.org/2000/svg"><path d="M0 146.539H47.835V141.455H44.243C37.2513 141.455 35.5676 139.547 35.5676 132.572V69.5024C40.4425 61.244 47.0011 55.9521 55.2596 55.9521C65.6348 55.9521 71.985 63.5692 71.985 77.9694V132.588C71.985 139.579 70.2852 141.471 63.5181 141.471H59.7016V146.555H106.478V141.471H103.095C96.103 141.471 94.4192 139.563 94.4192 132.588V75.6282C94.4192 73.7199 94.4192 71.8116 94.2108 69.9194C98.8612 61.4524 105.853 55.9521 114.111 55.9521C124.487 55.9521 130.837 63.5692 130.837 77.9694V132.588C130.837 139.579 129.137 141.471 122.37 141.471H118.553V146.555H165.33V141.471H162.155C154.955 141.471 153.271 139.563 153.271 132.588V75.6282C153.271 54.2523 141.212 42.4018 123.637 42.4018C110.519 42.4018 99.0857 49.6019 92.9439 63.9861C89.3519 50.0189 78.7682 42.4018 64.7849 42.4018C52.293 42.4018 41.5008 49.169 35.5676 62.7193V44.9355H0V50.0189H4.23347C11.4336 50.0189 13.1173 51.9271 13.1173 58.9027V132.572C13.1173 139.563 11.4175 141.455 4.23347 141.455H0V146.539ZM193.473 28.0016C201.09 28.0016 207.44 21.6514 207.44 14.0344C207.44 6.41731 201.09 0.0671082 193.473 0.0671082C185.856 0.0671082 179.506 6.41731 179.506 14.0344C179.506 21.6514 185.856 28.0016 193.473 28.0016ZM169.772 146.539H216.757V141.455H213.582C206.59 141.455 204.906 139.547 204.906 132.572V44.9355H169.339V50.0189H173.572C180.772 50.0189 182.456 51.9271 182.456 58.9027V132.572C182.456 139.563 180.756 141.455 173.572 141.455H169.756V146.539H169.772ZM251.058 86.8533H264.608C261.224 84.7365 259.958 81.7699 258.258 76.2696L253.174 57.4274C250.849 48.9605 248.941 44.9355 239.624 44.9355H220.157V50.0189H222.915C228.623 50.0189 229.265 52.1356 230.965 58.4858L235.407 75.0028C237.732 83.0528 241.34 86.8533 251.074 86.8533H251.058ZM282.392 86.8533H295.942C305.676 86.8533 309.059 83.0367 311.401 75.0028L315.843 58.4858C317.542 52.1356 318.376 50.0189 323.893 50.0189H326.651V44.9355H307.392C297.866 44.9355 295.958 48.752 293.841 57.4274L288.758 76.2696C287.058 81.9784 285.775 84.7365 282.392 86.8533ZM264.608 104.637H282.392V86.8533H264.608V104.637ZM220.157 146.555H239.624C248.941 146.555 250.849 142.53 253.174 134.063L258.258 115.221C259.958 109.72 261.224 106.754 264.608 104.637H251.058C241.324 104.637 237.716 108.454 235.391 116.488L230.949 133.005C229.249 139.355 228.623 141.471 222.899 141.471H220.141V146.555H220.157ZM307.36 146.555H326.619V141.471H323.861C318.36 141.471 317.51 139.355 315.811 133.005L311.369 116.488C309.043 108.438 305.66 104.637 295.91 104.637H282.392C285.775 106.754 287.01 109.512 288.71 115.221L293.793 134.063C295.91 142.738 297.818 146.555 307.344 146.555H307.36ZM329.377 188.89H378.479V183.806H373.395C366.628 183.806 364.928 181.898 364.928 174.922V134.496C371.07 143.604 381.445 149.105 393.713 149.105C416.788 149.105 435.198 128.787 435.198 93.6525C435.198 61.9014 417.847 42.4339 395.397 42.4339C382.279 42.4339 371.263 50.0509 364.912 63.6012V44.9676H329.345V50.0509H333.578C340.57 50.0509 342.462 51.9592 342.462 58.9348V174.906C342.462 181.898 340.554 183.79 333.578 183.79H329.345V188.874L329.377 188.89ZM387.379 55.5352C401.137 55.5352 412.363 68.4441 412.363 94.0534C412.363 121.988 401.987 137.238 387.812 137.238C378.703 137.238 370.669 132.363 364.944 123.896V71.3947C370.445 61.0195 378.286 55.5192 387.379 55.5192V55.5352ZM468.665 148.672C482.423 148.672 493.424 142.113 501.682 127.296V129.621C501.682 142.321 509.732 147.822 523.058 147.822C527.083 147.822 532.167 147.405 535.55 146.346V141.055C533.85 141.471 532.583 141.696 531.317 141.696C526.025 141.696 524.325 138.521 524.325 133.437V79.2362C524.325 54.2523 510.358 42.4018 486.865 42.4018C471.198 42.4018 455.964 49.6019 446.23 57.219L449.614 63.1522C459.781 56.1606 469.723 52.1516 480.515 52.1516C494.482 52.1516 501.682 59.7687 501.682 77.5525V82.2029L475.64 92.3696C451.939 102.103 443.248 111.212 443.248 124.971C443.248 138.729 452.981 148.672 468.648 148.672H468.665ZM465.489 119.454C465.489 108.871 471.631 101.253 484.123 95.7532L501.698 88.1361V121.154C495.14 130.262 487.523 135.554 479.264 135.554C471.006 135.554 465.505 129.845 465.505 119.47L465.489 119.454ZM539.784 146.555H588.052V141.471H584.027C577.035 141.471 575.351 139.563 575.351 132.588V69.7109C580.226 61.244 587.41 55.9521 595.877 55.9521C606.878 55.9521 613.869 63.5692 613.869 77.9694V132.588C613.869 139.579 612.17 141.471 605.402 141.471H601.377V146.555H649.421V141.471H645.187C637.987 141.471 636.304 139.563 636.304 132.588V75.6282C636.304 54.2523 623.603 42.4018 605.611 42.4018C592.494 42.4018 581.477 49.169 575.335 62.7193V44.9355H539.768V50.0189H544.001C551.201 50.0189 552.885 51.9271 552.885 58.9027V132.572C552.885 139.563 551.185 141.455 544.001 141.455H539.768V146.539L539.784 146.555ZM704.456 149.089C718.423 149.089 731.557 142.738 741.082 135.121L737.907 130.471C729.44 136.613 719.915 139.355 711.031 139.355C689.446 139.355 676.746 124.121 676.746 94.4863V90.6698H743.632C743.215 62.0939 725.639 42.6263 700.03 42.6263C674.421 42.6263 653.879 65.7019 653.879 96.1861C653.879 129.637 672.93 149.105 704.472 149.105L704.456 149.089ZM700.223 47.9021C712.923 47.9021 720.748 61.6609 722.031 84.945H677.163C679.071 61.4524 687.955 47.9021 700.239 47.9021H700.223ZM748.266 146.539H797.368V141.455H792.493C785.501 141.455 783.818 139.547 783.818 132.572V2.60078H748.25V7.68415H752.483C759.475 7.68415 761.367 9.59242 761.367 16.568V132.572C761.367 139.563 759.459 141.455 752.483 141.455H748.25V146.539H748.266Z" fill="currentColor"></path></svg></a><a class="nextra-focus _text-sm contrast-more:_text-gray-700 contrast-more:dark:_text-gray-100 max-md:_hidden _whitespace-nowrap _font-medium _subpixel-antialiased" aria-current="true" href="/docs/what-is-mixpanel">Docs</a><a class="nextra-focus _text-sm contrast-more:_text-gray-700 contrast-more:dark:_text-gray-100 max-md:_hidden _whitespace-nowrap _text-gray-600 hover:_text-gray-800 dark:_text-gray-400 dark:hover:_text-gray-200" aria-current="false" href="/guides/onboarding-overview">Guides</a><a class="nextra-focus _text-sm contrast-more:_text-gray-700 contrast-more:dark:_text-gray-100 max-md:_hidden _whitespace-nowrap _text-gray-600 hover:_text-gray-800 dark:_text-gray-400 dark:hover:_text-gray-200" aria-current="false" href="/changelogs">Changelog</a><a class="nextra-focus _text-sm contrast-more:_text-gray-700 contrast-more:dark:_text-gray-100 max-md:_hidden _whitespace-nowrap _text-gray-600 hover:_text-gray-800 dark:_text-gray-400 dark:hover:_text-gray-200" aria-current="false" href="https://developer.mixpanel.com/reference" target="_blank" rel="noreferrer">API Docs ↗</a><div class="top-nav-search-bar Search_inputContainer__iuFyS"><svg viewBox="0 0 24 24" focusable="false" class="Search_icon__1j_yz"><path fill="currentColor" d="M23.414,20.591l-4.645-4.645a10.256,10.256,0,1,0-2.828,2.829l4.645,4.644a2.025,2.025,0,0,0,2.828,0A2,2,0,0,0,23.414,20.591ZM10.25,3.005A7.25,7.25,0,1,1,3,10.255,7.258,7.258,0,0,1,10.25,3.005Z"></path></svg><input class="Search_searchBar__rnWt2" readonly="" placeholder="Search (⌘ + K)"/></div><a class="nextra-focus" href="https://github.com/mixpanel/docs" target="_blank" rel="noreferrer"><svg width="24" height="24" fill="currentColor" viewBox="3 3 18 18"><title>GitHub</title><path d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z"></path></svg><span class="_sr-only">GitHub</span></a><a class="SignUpButton_signUpButton__A6W7r" href="https://mixpanel.com/register">Sign Up</a><button class="_transition nextra-hamburger _rounded md:_hidden" aria-label="Menu" type="button" data-headlessui-state=""><svg fill="none" width="24" height="24" viewBox="0 0 24 24" stroke="currentColor" class=""><g><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16"></path></g><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12h16"></path><g><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 18h16"></path></g></svg></button></nav></div><div class="_mx-auto _flex _max-w-[90rem]"><div class="[transition:background-color_1.5s_ease] _bg-transparent"></div><aside class="nextra-sidebar-container _flex _flex-col md:_top-16 md:_shrink-0 motion-reduce:_transform-none motion-reduce:_transition-none [.resizing_&]:_transition-none _transform-gpu _transition-all _ease-in-out print:_hidden md:_w-64 md:_sticky md:_self-start max-md:[transform:translate3d(0,-100%,0)]"><div class="_px-4 _pt-4 md:_hidden"><div class="top-nav-search-bar Search_inputContainer__iuFyS"><svg viewBox="0 0 24 24" focusable="false" class="Search_icon__1j_yz"><path fill="currentColor" d="M23.414,20.591l-4.645-4.645a10.256,10.256,0,1,0-2.828,2.829l4.645,4.644a2.025,2.025,0,0,0,2.828,0A2,2,0,0,0,23.414,20.591ZM10.25,3.005A7.25,7.25,0,1,1,3,10.255,7.258,7.258,0,0,1,10.25,3.005Z"></path></svg><input class="Search_searchBar__rnWt2" readonly="" placeholder="Search (⌘ + K)"/></div></div><div class="_overflow-y-auto _p-4 _grow md:_h-[calc(100vh-var(--nextra-navbar-height)-var(--nextra-menu-height))] nextra-scrollbar"><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-100" style="transition-duration:500ms"><div><ul class="_flex _flex-col _gap-1 nextra-menu-desktop max-md:_hidden"><li class="[word-break:break-word] [&:not(:first-child)]:_mt-5 _mb-2 _px-2 _py-1.5 _text-sm _font-semibold _text-gray-900 dark:_text-gray-100"><div class="sidebar_titleContainer__MLEoO"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.9157 0.592901C11.278 0.224711 10.4626 0.44321 10.0944 1.08093L9.44389 2.20759C9.78993 1.57419 9.56859 0.77702 8.94015 0.41419C8.30243 0.0460003 7.48697 0.264501 7.11878 0.902224L3.45173 7.25374L3.45079 7.25319L3.22866 5.4095C3.129 4.58237 2.40946 3.97133 1.57712 4.007C0.68727 4.04514 0.00114492 4.80476 0.0534419 5.69389L0.34757 10.6945C0.412002 11.7899 1.02283 12.7796 1.97315 13.3283L5.49986 15.5C7.41303 16.6046 10.8953 15.4132 11.9999 13.5L15.4838 7.74581C15.852 7.10809 15.6335 6.29263 14.9958 5.92444C14.3589 5.55672 13.5447 5.7742 13.1758 6.41006L14.0463 4.90231C14.4145 4.26458 14.196 3.44913 13.5583 3.08094C12.9261 2.71593 12.1192 2.92751 11.7466 3.55253L12.4038 2.41427C12.772 1.77654 12.5535 0.961091 11.9157 0.592901Z" fill="#B094FF"></path><path d="M9.42773 2.23535L6.76107 6.85415" stroke="#7856FF" stroke-linecap="round"></path><path d="M11.7373 3.5686L9.07064 8.18741" stroke="#7856FF" stroke-linecap="round"></path><path d="M13.2979 6.10181L11.2979 9.56591" stroke="#7856FF" stroke-linecap="round"></path><path d="M3.45117 7.25293L3.5789 8.57034C3.67239 9.53467 4.22585 10.3945 5.0649 10.8789L5.17126 10.9403C6.12784 11.4926 6.45559 12.7158 5.90331 13.6724L5.73664 13.961" stroke="#7856FF" stroke-linecap="round" stroke-linejoin="round"></path></svg> INTRO</div></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/what-is-mixpanel">What is Mixpanel?</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/what-to-track">What to Track</a></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/quickstart">Quickstart<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/quickstart/install-mixpanel">Install Mixpanel</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/quickstart/identify-users">Identify Users</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/quickstart/track-events">Track Events</a></li></ul></div></div></li><li class="[word-break:break-word] [&:not(:first-child)]:_mt-5 _mb-2 _px-2 _py-1.5 _text-sm _font-semibold _text-gray-900 dark:_text-gray-100"><div class="sidebar_titleContainer__MLEoO"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M11 0C11.5523 0 12 0.447715 12 1V8H15C15.5523 8 16 8.44771 16 9V15C16 15.5523 15.5523 16 15 16H9C8.44772 16 8 15.5523 8 15V12H1C0.447716 12 0 11.5523 0 11V1C0 0.447715 0.447715 0 1 0H11Z" fill="#B094FF"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M8 12H11C11.5523 12 12 11.5523 12 11V8H9C8.44772 8 8 8.44772 8 9V12Z" fill="#7856FF"></path><path d="M3 3L6.5 6.5" stroke="#7856FF" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.5 3.5V6.5H3.5" stroke="#7856FF" stroke-linecap="round" stroke-linejoin="round"></path></svg> DATA IN</div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods">Tracking Methods<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/choosing-the-right-method">Choosing the Right Method</a></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks">SDKs<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/javascript">Javascript</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/react-native">React Native</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/android">Android</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/ios">iOS (Objective-C)</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/swift">iOS (Swift)</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/flutter">Flutter</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/unity">Unity</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/python">Python</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/nodejs">Node.js</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/ruby">Ruby</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/php">PHP</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/go">Go</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/sdks/java">Java</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="https://github.com/mixpanel/mixpanel-utils" target="_blank" rel="noreferrer">Mixpanel-utils↗</a></li></ul></div></div></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/data-warehouse">Data Warehouse</a></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations">Integrations<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/ad-spend">Ad Spend</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/amazon-s3">Amazon S3</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/aws-kafka">Amazon Kafka</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/cms-ecommerce">CMS & E-Commerce</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="https://customer.io/docs/cdp/destinations/connections/mixpanel?utm_source=mixpanel&utm_medium=partner" target="_blank" rel="noreferrer">Customer.io ↗</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/freshpaint">Freshpaint</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/google-cloud-storage">Google Cloud Storage</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/google-pubsub">Google Pubsub</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/google-sheets">Google Sheets</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/google-tag-manager">Google Tag Manager</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/launchdarkly">LaunchDarkly</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/mparticle">mParticle</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/mobile-attribution-tracking">Mobile Attribution Tracking</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/rudderstack">Rudderstack</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/segment">Segment</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="https://apps.shopify.com/vendo?utm_source=mixpanel&utm_medium=partner" target="_blank" rel="noreferrer">Shopify ↗</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/snowplow">Snowplow</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/stripe">Stripe</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/integrations/tealium">Tealium</a></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/id-management">ID Management<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/id-management/identifying-users-simplified">Identifying Users</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-methods/id-management/migrating-to-simplified-id-merge-system">Migrating to Simplified ID Merge</a></li></ul></div></div></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure">Data Structure<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure/concepts">Data Model</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure/events-and-properties">Events & Properties</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure/user-profiles">User Profiles</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure/group-analytics">Group Analytics</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure/lookup-tables">Lookup Tables</a></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure/property-reference">Property Reference<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure/property-reference/properties">Types of Properties</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure/property-reference/data-type">Supported Properties Data Type</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure/property-reference/default-properties">Default Properties</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-structure/property-reference/reserved-properties">Reserved Properties</a></li></ul></div></div></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/migration">Migration<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/migration/adobe-analytics">Adobe Analytics</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/migration/amplitude">Amplitude</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/migration/google-analytics">Google Analytics</a></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-best-practices">Best Practices<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-best-practices/bot-traffic">Bot Traffic</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-best-practices/debugging">Debugging</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-best-practices/developer-environments">Developer Environments</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-best-practices/geolocation">Geolocation</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-best-practices/hot-shard-limits">Hot Shard Limits</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-best-practices/server-side-best-practices">Server-side Best Practices</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-best-practices/tracking-plan">Tracking Plan</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/tracking-best-practices/traffic-attribution">Traffic Attribution</a></li></ul></div></div></li><li class="[word-break:break-word] [&:not(:first-child)]:_mt-5 _mb-2 _px-2 _py-1.5 _text-sm _font-semibold _text-gray-900 dark:_text-gray-100"><div class="sidebar_titleContainer__MLEoO"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1487_63098)"><path d="M2 16L14 16C15.1046 16 16 15.1046 16 14L16 2C16 0.895433 15.1046 1.81341e-06 14 1.69753e-06L2 4.38646e-07C0.895429 3.22768e-07 -7.75506e-07 0.895432 -8.58276e-07 2L-1.75748e-06 14C-1.84025e-06 15.1046 0.895428 16 2 16Z" fill="#B094FF"></path><path d="M3 7L6 4L9 7L13 3" stroke="#7856FF" stroke-linecap="round" stroke-linejoin="round"></path><path d="M3 11V13" stroke="#7856FF" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8 10L8 13" stroke="#7856FF" stroke-linecap="round" stroke-linejoin="round"></path><path d="M13 11V13" stroke="#7856FF" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_1487_63098"><rect width="16" height="16" fill="white"></rect></clipPath></defs></svg> ANALYSIS</div></li><li class="open"><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/reports">Reports<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180 *:ltr:_rotate-90 *:rtl:_rotate-[-270deg]"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-100" style="transition-duration:500ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/reports/insights">Insights</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/reports/funnels">Funnels</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/reports/retention">Retention</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/reports/flows">Flows</a></li><li class="open"><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/reports/apps">Apps<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180 *:ltr:_rotate-90 *:rtl:_rotate-[-270deg]"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-100" style="transition-duration:500ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/reports/apps/experiments">Experiments</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/reports/apps/impact">Impact</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/reports/apps/signal">Signal</a></li><li class="_flex _flex-col _gap-1 active"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _bg-primary-100 _font-semibold _text-primary-800 dark:_bg-primary-400/10 dark:_text-primary-600 contrast-more:_border-primary-500 contrast-more:dark:_border-primary-500" href="/docs/reports/apps/jql">JQL</a></li></ul></div></div></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/boards">Boards<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/boards/templates">Templates</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/boards/boards-on-boards">Boards on Boards</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/boards/public-boards">Public Boards</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/boards/advanced">Advanced</a></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/users">Users<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/users/cohorts">Cohorts</a></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/session-replay">Session Replay<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/session-replay/session-replay-web">Web</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/session-replay/session-replay-ios">iOS (Alpha)</a></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features">Features<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/alerts">Alerts</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/attribution">Attribution</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/embeds">Embeds</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/chart-customization">Chart Customization</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/custom-events">Custom Events</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/custom-properties">Custom Properties</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/saved-behaviors">Saved Behaviors</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/sessions">Sessions</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/spark">Spark</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/advanced">Advanced</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/features/revenue_analytics">Revenue Analytics</a></li></ul></div></div></li><li class="[word-break:break-word] [&:not(:first-child)]:_mt-5 _mb-2 _px-2 _py-1.5 _text-sm _font-semibold _text-gray-900 dark:_text-gray-100"><div class="sidebar_titleContainer__MLEoO"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 7V4C5 2.34315 6.34315 1 8 1V1C9.65685 1 11 2.34315 11 4V7" stroke="#7856FF" stroke-linejoin="round"></path><path d="M1 7.33325C1 6.22868 1.89543 5.33325 3 5.33325H13C14.1046 5.33325 15 6.22868 15 7.33325V13.9999C15 15.1045 14.1046 15.9999 13 15.9999H3C1.89543 15.9999 1 15.1045 1 13.9999V7.33325Z" fill="#B094FF"></path><path d="M6.58273 12.6098L7.9987 9.77783L9.41468 12.6098C9.5809 12.9422 9.33916 13.3334 8.96746 13.3334H7.02994C6.65825 13.3334 6.4165 12.9422 6.58273 12.6098Z" fill="#7856FF"></path><circle cx="7.99886" cy="9.33333" r="1.33333" fill="#7856FF"></circle></svg> ADMIN</div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/orgs-and-projects">Orgs & Projects<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/orgs-and-projects/organizations">Organizations</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/orgs-and-projects/managing-projects">Managing Projects</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/orgs-and-projects/roles-and-permissions">Roles & Permissions</a></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-governance">Data Governance<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-governance/lexicon">Lexicon</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-governance/data-views-and-classification">Data Views & Classification</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-governance/event-approval">Event Approval</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-governance/data-volume-monitoring">Data Volume Monitoring</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-governance/data-clean-up">Data Clean-Up</a></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/access-security">Access Security<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/access-security/login-methods">Login Methods</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/access-security/two-factor-authentication">Two-Factor Authentication</a></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/access-security/single-sign-on">Single Sign-On<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/access-security/single-sign-on/azure">Azure</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/access-security/single-sign-on/jumpcloud">JumpCloud</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/access-security/single-sign-on/okta">Okta</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/access-security/single-sign-on/shared-sso">Shared SSO</a></li></ul></div></div></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/privacy">Privacy<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/privacy/protecting-user-data">Protecting User Data</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="https://mixpanel.com/legal/privacy-policy" target="_blank" rel="noreferrer">Legal Hub ↗</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/privacy/gdpr-compliance">GDPR Compliance</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/privacy/eu-residency">EU Residency</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/privacy/in-residency">India Residency</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/privacy/end-user-data-management">End User Data Management</a></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/pricing">Pricing<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/pricing/legacy-mtu-billing">MTU Billing</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/pricing/startup-program">Startup Program</a></li></ul></div></div></li><li class="[word-break:break-word] [&:not(:first-child)]:_mt-5 _mb-2 _px-2 _py-1.5 _text-sm _font-semibold _text-gray-900 dark:_text-gray-100"><div class="sidebar_titleContainer__MLEoO"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 0C4.44772 0 4 0.447715 4 1V8H1C0.447715 8 0 8.44771 0 9V15C0 15.5523 0.447715 16 1 16H7C7.55228 16 8 15.5523 8 15V12H15C15.5523 12 16 11.5523 16 11V1C16 0.447715 15.5523 0 15 0H5Z" fill="#B094FF"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M8 12H5C4.44772 12 4 11.5523 4 11V8H7C7.55228 8 8 8.44772 8 9V12Z" fill="#7856FF"></path><path d="M9.5 6.5L13 3" stroke="#7856FF" stroke-linecap="round" stroke-linejoin="round"></path><path d="M13 6V3H10" stroke="#7856FF" stroke-linecap="round" stroke-linejoin="round"></path></svg> DATA OUT</div></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/export-methods">Export Methods</a></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines">Data Pipelines<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/json-pipelines">Json Pipelines</a></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/integrations">Integrations<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/integrations/aws-s3">AWS S3</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/integrations/azure-blob-storage">Azure Blob Storage</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/integrations/bigquery">BigQuery</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/integrations/gcp-gcs">Google Cloud Storage</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/integrations/redshift-spectrum">Redshift Spectrum</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/integrations/snowflake">Snowflake</a></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines">Older Version<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines/schematized-export-pipeline">Schematized Export Pipeline</a></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines/integrations">Integrations<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines/integrations/raw-aws-pipeline">Raw AWS Pipeline</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines/integrations/raw-azure-pipeline">Raw Azure Pipeline</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines/integrations/raw-gcs-pipeline">Raw GCS Pipeline</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines/integrations/schematized-bigquery-pipeline">Schematized BigQuery Pipeline</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines/integrations/schematized-aws-pipeline">Schematized AWS Pipeline</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines/integrations/schematized-azure-pipeline">Schematized Azure Pipeline</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines/integrations/schematized-gcs-pipeline">Schematized GCS Pipeline</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/data-pipelines/old-pipelines/integrations/schematized-snowflake-pipeline">Schematized Snowflake Pipeline</a></li></ul></div></div></li></ul></div></div></li></ul></div></div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync">Cohort Sync<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/webhooks">Webhooks</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/build-an-integration">Build an Integration</a></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations">Integrations<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/abtasty">AB Tasty</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/airship">Airship</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/appcues">Appcues</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/apptimize">Apptimize</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/braze">Braze</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/chameleon">Chameleon</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/clevertap">CleverTap</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/facebook-ads">Facebook Ads</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/google-ads">Google Ads</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/insider">Insider</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="https://www.intercom.com/help/en/articles/299-import-your-mixpanel-contacts" target="_blank" rel="noreferrer">Intercom ↗</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/iterable">Iterable</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/kameleoon">Kameleoon</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/leanplum">Leanplum</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/mailchimp">Mailchimp</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/marketo">Marketo</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/moengage">MoEngage</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/onesignal">OneSignal</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/salesforce-marketing-cloud">Salesforce Marketing Cloud</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/segment">Segment</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/taplytics">Taplytics</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/vwo">VWO</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/webengage">WebEngage</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/cohort-sync/integrations/xtremepush">Xtremepush</a></li></ul></div></div></li></ul></div></div></li><li class="[word-break:break-word] [&:not(:first-child)]:_mt-5 _mb-2 _px-2 _py-1.5 _text-sm _font-semibold _text-gray-900 dark:_text-gray-100"><div class="sidebar_titleContainer__MLEoO"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.08579 14.0858L7.29289 15.2929C7.68342 15.6834 8.31658 15.6834 8.70711 15.2929L9.91421 14.0858C10.2893 13.7107 10.798 13.5 11.3284 13.5H14C15.1046 13.5 16 12.6046 16 11.5V2C16 0.895431 15.1046 0 14 0H2C0.895431 0 0 0.89543 0 2V11.5C0 12.6046 0.895431 13.5 2 13.5H4.67157C5.20201 13.5 5.71071 13.7107 6.08579 14.0858Z" fill="#B094FF"></path><circle cx="12.0001" cy="6.66659" r="1.33333" fill="#7856FF"></circle><circle cx="8.00008" cy="6.66659" r="1.33333" fill="#7856FF"></circle><circle cx="4.00008" cy="6.66659" r="1.33333" fill="#7856FF"></circle></svg> SUPPORT</div></li><li class=""><a class="nextra-focus _items-center _justify-between _gap-2 _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/community">Community<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="18" class="_shrink-0 _rounded-sm _p-0.5 hover:_bg-gray-800/5 dark:hover:_bg-gray-100/5 motion-reduce:*:_transition-none *:_origin-center *:_transition-transform *:rtl:_-rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a><div class="_transform-gpu _transition-all _ease-in-out motion-reduce:_transition-none _opacity-0 _overflow-hidden" style="height:0;transition-duration:300ms"><div><ul class="_flex _flex-col _gap-1 _relative before:_absolute before:_inset-y-1 before:_w-px before:_bg-gray-200 before:_content-[""] dark:before:_bg-neutral-800 ltr:_pl-3 ltr:before:_left-0 rtl:_pr-3 rtl:before:_right-0 _pt-1 ltr:_ml-3 rtl:_mr-3"><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="https://www.mixpanel.com/community-slack" target="_blank" rel="noreferrer">Join Slack ↗</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/community/guidelines">Guidelines</a></li></ul></div></div></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="https://mixpanel.com/get-support" target="_blank" rel="noreferrer">Get Help ↗</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="/docs/response-times">Response Times</a></li><li class="_flex _flex-col _gap-1"><a class="nextra-focus _flex _rounded _px-2 _py-1.5 _text-sm _transition-colors [word-break:break-word] _cursor-pointer contrast-more:_border _text-gray-500 hover:_bg-gray-100 hover:_text-gray-900 dark:_text-neutral-400 dark:hover:_bg-primary-100/5 dark:hover:_text-gray-50 contrast-more:_text-gray-900 contrast-more:dark:_text-gray-50 contrast-more:_border-transparent contrast-more:hover:_border-gray-900 contrast-more:dark:hover:_border-gray-50" href="https://mixpanel.com/partners/experts/matchmaking" target="_blank" rel="noreferrer">Hire an Expert ↗</a></li></ul></div></div></div><div class="nextra-sidebar-footer _sticky _bottom-0 _flex _items-center _gap-2 _py-4 _mx-3 _px-1" data-toggle-animation="off"><div class="_grow _flex _flex-col"><button title="Change theme" class="_h-7 _rounded-md _px-2 _text-xs _font-medium _transition-colors _text-gray-600 dark:_text-gray-400" id="headlessui-listbox-button-:R6tsr6:" type="button" aria-haspopup="listbox" aria-expanded="false" data-headlessui-state=""><div class="_flex _items-center _gap-2 _capitalize"><svg fill="none" viewBox="3 3 18 18" width="12" height="12" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" fill="currentColor" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path></svg><span class="">Light</span></div></button></div><button class="_transition max-md:_hidden _rounded-md _p-2 _text-gray-600 dark:_text-gray-400" title="Hide sidebar" type="button" data-headlessui-state=""><svg viewBox="0 0 16 16" fill="currentColor" height="12" class=""><path d="M4.177 7.823l2.396-2.396A.25.25 0 017 5.604v4.792a.25.25 0 01-.427.177L4.177 8.177a.25.25 0 010-.354z"></path><path fill-rule="evenodd" d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0114.25 16H1.75A1.75 1.75 0 010 14.25V1.75zm1.75-.25a.25.25 0 00-.25.25v12.5c0 .138.112.25.25.25H9.5v-13H1.75zm12.5 13H11v-13h3.25a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25z"></path></svg></button></div></aside><nav class="nextra-toc _order-last max-xl:_hidden _w-64 _shrink-0 print:_hidden" aria-label="table of contents"><div class="nextra-scrollbar _sticky _top-16 _overflow-y-auto _px-4 _pt-6 _text-sm [hyphens:auto] _max-h-[calc(100vh-var(--nextra-navbar-height)-env(safe-area-inset-bottom))] ltr:_-mr-4 rtl:_-ml-4"><p class="_mb-4 _font-semibold _tracking-tight">On This Page</p><ul><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#querying-events" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">Querying Events</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#event-object-specification" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">Event Object Specification</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#querying-profiles" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">Querying Profiles</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#user-object-specification" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">User Object Specification</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#combining-events-and-profiles" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">Combining Events and Profiles</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#joined-object-specification" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">Joined Object Specification</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#join-operation-details" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">join() Operation Details</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#passing-parameters-to-a-query" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">Passing Parameters to a Query</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#filterfunctionitem-" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">filter(function(item) {})</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mapfunctionitem-" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">map(function(item) {})</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#reducereducer-functions" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">reduce([reducer function(s)])</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#groupbykeys-reducer-functions" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">groupBy([keys], [reducer function(s)])</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#groupbyuseroptional-additional-keys-reducer-functions" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">groupByUser([optional additional keys], [reducer function(s)])</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#flatten" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">flatten()</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#sortascaccessor" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">sortAsc(accessor)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#sortdescaccessor" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">sortDesc(accessor)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducercount" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.count()</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducersumaccessor" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.sum(accessor)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducernumeric_summaryaccessor" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.numeric_summary(accessor)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreduceravgaccessor" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.avg(accessor)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducernumeric_percentilesaccessor-percentiles-spec" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.numeric_percentiles(accessor, percentiles spec)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducerminaccessormaxaccessor" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.min(accessor)/max(accessor)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducermin_byaccessormax_byaccessor" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.min_by(accessor)/max_by(accessor)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducertoplimit" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.top(limit)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducerapplygrouplimitslimit-spec" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.applyGroupLimits(limit spec)/</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducerobject_merge" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.object_merge()</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducerany" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.any()</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelreducernull" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.reducer.null()</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelnumeric_bucketaccessor-buckets-spec" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.numeric_bucket(accessor, buckets spec)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelto_numberaccessor" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.to_number(accessor)</a></li><li class="_my-2 _scroll-my-6 _scroll-py-6"><a href="#mixpanelnumeric_bucket" class="nextra-focus _font-semibold _block _transition-colors _subpixel-antialiased _text-gray-500 hover:_text-gray-900 dark:_text-gray-400 dark:hover:_text-gray-300 contrast-more:_text-gray-900 contrast-more:_underline contrast-more:dark:_text-gray-50 _break-words">mixpanel.numeric_bucket()</a></li></ul><div class="nextra-toc-footer _mt-8 _pt-8 _sticky _bottom-0 _flex _flex-col _items-start _gap-2 _pb-8 _-mx-1 _px-1"><a class="nextra-focus _text-xs _font-medium _text-gray-600 dark:_text-gray-400 hover:_text-gray-800 dark:hover:_text-gray-200 contrast-more:_text-gray-700 contrast-more:dark:_text-gray-100" href="https://mixpanel.com/get-support" target="_blank" rel="noreferrer">Question? Contact our Support Team</a><a class="nextra-focus _text-xs _font-medium _text-gray-600 dark:_text-gray-400 hover:_text-gray-800 dark:hover:_text-gray-200 contrast-more:_text-gray-700 contrast-more:dark:_text-gray-100" href="https://github.com/mixpanel/docs/tree/main/pages/docs/reports/apps/jql.md">Edit this page</a><button class="_transition _flex _items-center _gap-1.5 _opacity-0 _text-xs _font-medium _text-gray-600 dark:_text-gray-400 hover:_text-gray-800 dark:hover:_text-gray-200 contrast-more:_text-gray-700 contrast-more:dark:_text-gray-100" aria-hidden="true" type="button" disabled="" data-headlessui-state="disabled" data-disabled="">Scroll to top<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="16" class="_-rotate-90 _border _rounded-full _border-current"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></button></div></div></nav><div id="reach-skip-nav"></div><article class="_w-full _break-words nextra-content _flex _min-h-[calc(100vh-var(--nextra-navbar-height))] _min-w-0 _justify-center _pb-8 _pr-[calc(env(safe-area-inset-right)-1.5rem)]"><main class="_w-full _min-w-0 _max-w-6xl _px-6 _pt-4 md:_px-12"><div class="nextra-breadcrumb _mt-1.5 _flex _items-center _gap-1 _overflow-hidden _text-sm _text-gray-500 dark:_text-gray-400 contrast-more:_text-current"><span class="_whitespace-nowrap _transition-colors _min-w-6 _overflow-hidden _text-ellipsis" title="Docs">Docs</span><svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="14" class="_shrink-0 rtl:_rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg><a class="_whitespace-nowrap _transition-colors _min-w-6 _overflow-hidden _text-ellipsis nextra-focus _ring-inset hover:_text-gray-900 dark:hover:_text-gray-100" title="Reports" href="/docs/reports">Reports</a><svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="14" class="_shrink-0 rtl:_rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg><a class="_whitespace-nowrap _transition-colors _min-w-6 _overflow-hidden _text-ellipsis nextra-focus _ring-inset hover:_text-gray-900 dark:hover:_text-gray-100" title="Apps" href="/docs/reports/apps">Apps</a><svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" height="14" class="_shrink-0 rtl:_rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="_whitespace-nowrap _transition-colors _font-medium _text-gray-700 contrast-more:_font-bold contrast-more:_text-current dark:_text-gray-100 contrast-more:dark:_text-current" title="JQL">JQL</span></div><h1 class="_mt-2 _text-4xl _font-bold _tracking-tight _text-slate-900 dark:_text-slate-100">JQL: Create custom queries using Javascript code</h1> <blockquote class="[&:not(:first-child)]:_mt-6 _border-gray-300 _italic _text-gray-700 dark:_border-gray-700 dark:_text-gray-400 ltr:_border-l-2 ltr:_pl-6 rtl:_border-r-2 rtl:_pr-6"> <p class="[&:not(:first-child)]:_mt-6 _leading-7">❗️ JQL is in maintenance mode.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Mixpanel is not investing in JQL any further. If you would like to run arbitrary queries on your Mixpanel events, please use our <a class="nextra-focus _text-primary-600 _underline _decoration-from-font [text-underline-position:from-font]" href="https://developer.mixpanel.com/reference/raw-data-export-api" target="_blank" rel="noreferrer">Data Pipelines</a> add-on to export your events to your data warehouse.</p> </blockquote> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The JQL JavaScript code must define a <code class="nextra-code" dir="ltr">main()</code> function. This JavaScript will be compiled, and the <code class="nextra-code" dir="ltr">main()</code> function will be executed by the query engine. The return value of <code class="nextra-code" dir="ltr">main()</code> must be a sequence of zero or more transformations applied to a collection of events, user records or joined records.<br/> Events are retrieved by calling the <code class="nextra-code" dir="ltr">Events()</code> function.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">For example, the following query counts the number of events that happened on one day in 2016:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-04"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-04"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="querying-events" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">Querying Events<a href="#querying-events" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The events collection is fetched by calling <code class="nextra-code" dir="ltr">Events()</code> with a single object argument that describes what events should be fetched.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Get all signups and purchases by users with email addresses</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // from Yahoo or Gmail between January 1st and January 2nd</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'2016-01-01'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'2016-01-02'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors: [</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'signup'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, label: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'Signup'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">},</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'purchase'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, selector: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'"yahoo" in properties["$email"]'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> label: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'Purchase (Yahoo)'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">},</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'purchase'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, selector: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'"gmail" in properties["$email"]'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> label: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'Purchase (Gmail)'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ]</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="event-object-specification" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">Event Object Specification<a href="#event-object-specification" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The event objects returned from <code class="nextra-code" dir="ltr">Events()</code> have the following attributes:</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Attribute</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>name</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">string</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">The name of the event.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>distinct_id</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">string</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">The distinct_id of the user associated with this event. If distinct_id was not sent with the event, this will be undefined.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>time</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">integer</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">The timestamp of the event, expressed as milliseconds since January 1, 1970 in your project’s timezone, not UTC.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>sampling_factor</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">float</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">The rate at which this event was sampled (if you are using Mixpanel’s sampling feature). 0.05 means the event is being sampled at 5%. This is important for getting accurate counts of sampled events. If you are not using sampling, this will always be 1.0.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>properties</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">object</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">An object containing all of the properties of the event.</td></tr></tbody></table> <h2 id="querying-profiles" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">Querying Profiles<a href="#querying-profiles" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Profile data is fetched by calling <code class="nextra-code" dir="ltr">People()</code></p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>user_selectors</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">array</span><br/><span style="color:green">optional</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">An optional list of {selector: “Segmentation expression”} objects that restrict user records retrieved. A record is retrieved if it matches any of the expressions. Segmentation expression in user selectors expressions can only access user properties, not event properties. See also information on Segmentation expressions as <a class="nextra-focus _text-primary-600 _underline _decoration-from-font [text-underline-position:from-font]" href="https://developer.mixpanel.com/reference/segmentation-expressions" target="_blank" rel="noreferrer">argument to Events()</a>.</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // get all users who signed up in 2016</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">filter</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">){</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> user.properties.signup_date </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">>=</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Date</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">&&</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> user.properties.signup_date </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Date</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2017-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">);</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> });</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">or, equivalently:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // get all users who signed up in 2016</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> user_selectors:[{selector:</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> 'has_prefix(string(user["signup_date"]), "2016")'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}]</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> });</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="user-object-specification" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">User Object Specification<a href="#user-object-specification" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The user objects returned from <code class="nextra-code" dir="ltr">People()</code> have the following attributes:</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Attribute</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>distinct_id</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">string</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">The distinct_id of the user.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>time</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">integer</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">The timestamp of the most recent user record update, expressed as milliseconds since January 1, 1970 in your project’s timezone, not UTC.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>last_seen</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">integer</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">The timestamp of the most recent user record update provided via Set() method, expressed as milliseconds since January 1, 1970, in your project’s timezone.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>properties</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">object</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">An object containing all of the properties of the user.</td></tr></tbody></table> <h2 id="combining-events-and-profiles" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">Combining Events and Profiles<a href="#combining-events-and-profiles" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">You can combine (join) events and profile data using <code class="nextra-code" dir="ltr">join(Events(), People())</code> expression.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Apart from joined collection, join() accepts an optional third argument: an object with join options:</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>type</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">string</span><br/><span style="color:green">optional</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">Join type: full, left, right or inner. Default is a full join.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>selectors</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">string</span><br/><span style="color:green">optional</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">An optional list of {event: “event name”, selector: “Segmentation expression”} objects that restrict event/user pairs retrieved. A record is retreieved if it matches any of the selector objects. To learn more about selectors, refer to <a class="nextra-focus _text-primary-600 _underline _decoration-from-font [text-underline-position:from-font]" href="https://developer.mixpanel.com/reference/segmentation-expressions" target="_blank" rel="noreferrer">Segmentation API</a>. Segmentation expressions in join() selectors can access both events and user properties.</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> join</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }),</span></span> <span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(),</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Fetch tuples that satisfy muliple conditions:</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // * They're both event and user records.</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // * Event is sent from US.</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // * User age is above thirty.</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> type:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"inner"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> selectors:[{selector:</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> 'properties["country"] == "US" and user["age"] > 30'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}]</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> );</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="joined-object-specification" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">Joined Object Specification<a href="#joined-object-specification" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The objects returned from <code class="nextra-code" dir="ltr">join()</code> have the following attributes:</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Attribute</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>distinct_id</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">string</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">The distinct_id of both event and matching user.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>event</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">object</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">Event object. For users with no events, this property is undefined</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>user</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">object</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">User object with distinct_id matching the event. For events without distinct id or when there’s no matching user record, this property is undefined.</td></tr></tbody></table> <h2 id="join-operation-details" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">join() Operation Details<a href="#join-operation-details" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">You cannot apply any transformations to the collections inside <code class="nextra-code" dir="ltr">join()</code>. For example, this is not legal: <code class="nextra-code" dir="ltr">join(Events(...).map(...)</code>, <code class="nextra-code" dir="ltr">People(...).filter())</code></p> <h2 id="passing-parameters-to-a-query" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">Passing Parameters to a Query<a href="#passing-parameters-to-a-query" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The query engine creates and populates a <code class="nextra-code" dir="ltr">params</code> object inside the global context. The object is constructed from a JSON blob passed as the params argument to the JQL HTTP endpoint.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Query parameters allow you to write more flexible and reusable queries. We recommend populating Events <code class="nextra-code" dir="ltr">from_date/to_date</code> using params to make the query code reusable across different date ranges.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">For example, you could pass these params:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">params </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> start_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> end_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-10"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"View Blog"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">to this query:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: params.start_date,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: params.end_date,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">filter</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">event</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) { </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event.name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">==</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> params.event })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Alternatively, and more efficiently, you can pass multiple events as a list in a <code class="nextra-code" dir="ltr">params</code> object using <code class="nextra-code" dir="ltr">_.map</code>.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">For example, you could pass these params:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">params </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> start_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> end_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-10"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> events: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"View Blog"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"View Landing Page"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">};</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">to this query:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: params.start_date,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: params.end_date,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors: _.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">map</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(params.events, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">event</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> =></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ({event: event}))</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> });</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h1 class="_mt-2 _text-4xl _font-bold _tracking-tight _text-slate-900 dark:_text-slate-100">Transformations</h1> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Transformations are applied to collections, taking one collection as input and producing another. A transformation takes a user-defined function (or a built-in function) that controls how the transformation works.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The JQL API provides the following set of transformations, which can be chained together to do complex analysis.</p> <h2 id="filterfunctionitem-" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">filter(function(item) {})<a href="#filterfunctionitem-" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Filter the collection by calling the provided function on each of its elements. If the function evaluates to true, keep the element. Otherwise, discard it.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// filter for "login" events from users who signed up in January.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> join</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-04-01"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }),</span></span> <span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">filter</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">tuple</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> tuple.event </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">&&</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> tuple.user </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">&&</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> tuple.event.name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">==</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "login"</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> &&</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> tuple.user.properties.signup_date </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">>=</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Date</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">&&</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> tuple.user.properties.signup_date </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><=</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Date</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-02-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">);</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> });</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mapfunctionitem-" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">map(function(item) {})<a href="#mapfunctionitem-" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Build a new collection by applying the provided function to each element of the input collection. The output collection contains the return value of the provided function for each element in the input collection, so an input collection of size N will result in an output collection of size N.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Extract the email domain name for further analysis.</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// The resulting collection contains strings.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-07"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">map</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">event</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> var</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> pos </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event.properties.$email.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">indexOf</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"@"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">);</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event.properties.$email.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">slice</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(pos </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">);</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> });</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="reducereducer-functions" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">reduce([reducer function(s)])<a href="#reducereducer-functions" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">reduce()</code> turns the input collection into just a single value.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">It takes one argument - a reducer or list of reducer functions, which must implement the following signature:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">accumulators</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">items</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Combine previously-aggregated "accumulators"</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // with new "items" and return the result.</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">A reducer function accepts two arguments: an array of its previous results (accumulators), and an array of items to reduce. The first argument - accumulators - is used to break down the initial set of values into many calls of the reducer function. JQL runs the reduction in a hierarchical fashion, where some subsets of inputs are reduced to accumulator values first, and multiple accumulator values are combined subsequently. There are no guarantees on the order of input.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The example below is using a reduce function that counts elements up.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Count events.</span></span> <span> </span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-07"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">previous_counts</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> var</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> count </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> events.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">length</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">var</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> previous_counts.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">length</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">++</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> count </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> previous_counts[i];</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> count;</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> });</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Counting is a common use case, so JQL provides a built-in <code class="nextra-code" dir="ltr">mixpanel.reducer.count()</code> that could be used in place of the snippet above.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Count events.</span></span> <span> </span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-07"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">While there are built-in reducer methods to address common use cases, a reducer function is flexible and can be used to aggregate inputs into a single value. For example, returning the earliest timestamp and latest timestamp could be done using a reducer function.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Return earliest timestamp and latest timestamp of events</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-07"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">accumulators</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">items</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">){</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> var</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> result </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> earliest: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> latest: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">null</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> };</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">var</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> accumulators.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">length</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">++</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> result.earliest </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> minimum</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(result.earliest, accumulators[i].earliest);</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> result.latest </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> Math.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">max</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(result.latest, accumulators[i].latest);</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">var</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> j </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; j </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> items.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">length</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; j</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">++</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> result.earliest </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> minimum</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(result.earliest,items[j].time);</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> result.latest </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> Math.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">max</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(result.latest,items[j].time);</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> result;</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> });</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span> <span> </span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Helper function to return minimum value (ignoring null)</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> minimum</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">x</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">y</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">===</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> y;</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">===</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> x;</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> Math.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">min</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(x,y);</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="groupbykeys-reducer-functions" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">groupBy([keys], [reducer function(s)])<a href="#groupbykeys-reducer-functions" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Group the collection according to the provided list of keys, then apply the provided reducer function(s) to each group. The underlying action of <code class="nextra-code" dir="ltr">groupBy()</code> is similar to the one of <code class="nextra-code" dir="ltr">reduce()</code> - aggregating many input values into one. However, the output collection is different: while <code class="nextra-code" dir="ltr">reduce()</code> aggregates everything into a single value, <code class="nextra-code" dir="ltr">groupBy()</code> produces a collection with the following structure:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">{</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"><composite</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> group</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> key></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"><return</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> value</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> of</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> reducer</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> function</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> or</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> list</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> of</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> values</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> if</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> composite</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> reducer</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> supplied></span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The group key is computed from a key specification - the first argument of the <code class="nextra-code" dir="ltr">groupBy()</code> transformation. This argument is a list containing property names or functions that compute a key from a collection element.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">If you use property names as keys, you can use dot notation (i.e., a ”.”) to access values inside nested objects. For example, if you had a list of objects that looked like</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">{"item": "tshirt", "info": {"size": "XL"}}</code>, you could group by</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">["item", "info.size"]</code></p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">It is common to use dot notation to group on event properties. For example, in <code class="nextra-code" dir="ltr">Events(...).groupBy(['properties.$city', 'properties.$browser'], ...)</code>, each unique combination of City and Browser becomes a group, so the following groups may be output:</p> <ul class="[:is(ol,ul)_&]:_my-3 [&:not(:first-child)]:_mt-6 _list-disc ltr:_ml-6 rtl:_mr-6"> <li class="_my-2">[“New York”, “Firefox”]</li> <li class="_my-2">[“San Francisco”, “Firefox”]</li> <li class="_my-2">[“San Francisco”, “Safari”]</li> <li class="_my-2">etc.</li> </ul> <p class="[&:not(:first-child)]:_mt-6 _leading-7">As with a list of keys, the <code class="nextra-code" dir="ltr">groupBy()</code> can accept a single reducer or a list of reducer functions. Each reducer supplied in this argument is then applied to each group key. When a list of reducer functions is provided, the value for each group key will be a list of the results from each function. Reducer functions can include both built-in and custom reducer functions. The signature of a reduce function provided to a <code class="nextra-code" dir="ltr">groupBy()</code> is:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">accumulators</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">items</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Analyze items, return accummulators</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-02-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors: [{event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Change Plan"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> [</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "properties.New Plan"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "properties.Previous Plan"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // use a function to dynamically calculate a day of the event.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">ev</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Date</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(ev.time)).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">toDateString</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">();</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> [</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(),</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">any</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">()</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ]</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> );</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The group key can only include scalars - strings, numbers, booleans, nulls. If a group-by property evaluates to a list of multiple scalars, <code class="nextra-code" dir="ltr">groupBy()</code> can treat in two different ways:</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Inline that list into group key (this is the default behavior). The following query computes, for every sequence of notification campaigns each user participated in, the total number of profiles that have that sequence:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.$campaigns"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Create a different group key for each list element. The following query computes the number of users that participated in each campaign.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">multiple_keys</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.$campaigns"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]),</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">A single query can use both key treatments, even with the same property, like in a query below:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">multiple_keys</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.$campaigns"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]),</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "properties.$campaigns"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="groupbyuseroptional-additional-keys-reducer-functions" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">groupByUser([optional additional keys], [reducer function(s)])<a href="#groupbyuseroptional-additional-keys-reducer-functions" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Group events by distinct_id and, optionally, additional keys, then apply the provided reducer function(s) to each group.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">This transformation is a specialization of <code class="nextra-code" dir="ltr">groupBy()</code> that guarantees that the reduce function(s) will process all events of a single user in temporal order.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">This guarantee is reflected in the signature of the reduce function provided to <code class="nextra-code" dir="ltr">groupByUser()</code>:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">state</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Analyze events, aggregate in state. Return the new state.</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Its first argument is a single accumulator or a list of accumulators, but not an array of accumulators as used in <code class="nextra-code" dir="ltr">groupBy()</code> and <code class="nextra-code" dir="ltr">reduce()</code> cases. The accumulator value is always the value of last call to the reduce function, with an initial value of Undefined.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The difference in signature means that reducer function implementations can not be used interchangeably between <code class="nextra-code" dir="ltr">groupByUser()</code> and <code class="nextra-code" dir="ltr">groupBy()/reduce()</code>. Built-in reducers, however, can be used in both contexts.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The output of <code class="nextra-code" dir="ltr">groupByUser()</code> is a collection of objects with the following structure:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">{</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"><user</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> distinct_id></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">] </span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic">+</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> <optional</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> additional</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> keys></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"><return</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> value</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> of</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> reducer</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> function(s)></span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">groupByUser()</code> can only be applied to the source data collection. This means it must be called either on the <code class="nextra-code" dir="ltr">Events()</code>, <code class="nextra-code" dir="ltr">People()</code> or <code class="nextra-code" dir="ltr">join()</code> collections directly, or on the collection returned by <code class="nextra-code" dir="ltr">Events({ ... }).filter(...) or People({ ... }).filter(...) or join( ... ).filter(...)</code></p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">A very common use-case for <code class="nextra-code" dir="ltr">groupByUser()</code> is to compute some property of each user based on their behavior. For example, the code below computes what events users typically perform after a “login” event.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><strong>Frequencies of Events Following “Login”:</strong></p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// For each user, find how often they perform each event</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// after signing up.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-02-01"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupByUser</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">state</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> state </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> state </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">||</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { distribution: {} };</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (events.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">length</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> ==</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> state;</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">var</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> events.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">length</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> -</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">++</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">i) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (events[i].name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">==</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "login"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> state.distribution[events[i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">].name] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> state.distribution[events[i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">].name] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">||</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> ++</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">state.distribution[events[i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">].name];</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Previous call for this user may have contained</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // "login" as the last event.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (state.last_event_login) {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> state.distribution[events[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">].name] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> state.distribution[events[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">].name] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">||</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> ++</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">state.distribution[events[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">].name];</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // If last event is "login", next call should see that.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (events[events.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">length</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> -</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">].name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">==</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "login"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> state.last_event_login </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> state;</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> });</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">It is possible to compute more fine-grained aggregation with <code class="nextra-code" dir="ltr">groupByUser()</code> by providing a list of additional keys in the first argument. User distinct_id always remains the implicit first key.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The following example computes, for each user and each day, when they did their first event on that day.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><strong>Multiple Groups per User:</strong></p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// figure out the hour where the most users do something</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// for the first time that day</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-07"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // group the events for each user by day, then get</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // the first hour we saw them in each of those days.</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupByUser</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([getDay], </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">first_hour</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (first_hour </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">===</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> first_hour </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Date</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(events[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">].time)).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">getHours</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">();</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> first_hour;</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span> <span> </span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> getDay</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">event</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Date</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(event.time)).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">toISOString</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">split</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'T'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">)[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">];</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">groupByUser()</code> places the same restriction on group keys as <code class="nextra-code" dir="ltr">groupBy()</code> does: a key can only include scalars, and list keys can be treated in two different ways depending on presence of the <code class="nextra-code" dir="ltr">mixpanel.multiple_keys()</code> decorator.</p> <h2 id="flatten" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">flatten()<a href="#flatten" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Flatten the collection by inlining array elements of the input collection. The contents of arrays in the input collection are placed into the output collection. Input elements that are not arrays are forwarded into the output collection without modification.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Compute percentiles on counts for number</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// of events each user has done.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-07"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Compute the number of events for each user.</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupByUser</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">numeric_percentiles</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'value'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> [</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">10</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">25</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">50</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">75</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">90</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]))</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">flatten</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">();</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="sortascaccessor" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">sortAsc(accessor)<a href="#sortascaccessor" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Sort the input collection by the provided sort key - either property name or a function. Sort key must be a scalar.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Find the users who have used the product the least.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-07"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'properties.$email'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">], mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">sortAsc</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'value'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">);</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="sortdescaccessor" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">sortDesc(accessor)<a href="#sortdescaccessor" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Similar to <code class="nextra-code" dir="ltr">sortAsc()</code>, but sort in descending order.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Find the most popular events.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-07"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'name'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">], mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">sortDesc</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'value'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">);</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h1 class="_mt-2 _text-4xl _font-bold _tracking-tight _text-slate-900 dark:_text-slate-100">Chained Aggregations</h1> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Chaining <code class="nextra-code" dir="ltr">groupBy()</code> operations in JQL can be used to compute complex statistics. The simplest case for chained aggregations is the query below that computes the number of unique users that had events from each country:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupByUser</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.country"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">], mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([mixpanel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">slice</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">)], mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The first <code class="nextra-code" dir="ltr">.groupByUser()</code> transformation results in a collection of objects with the following structure: <code class="nextra-code" dir="ltr">{key:[distinct_id, country], value: null}</code>.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The second aggregation instructs JQL to strip off position 0 of the key holding the distinct_id, and aggregate again, counting results up. The result is going to be a number of unique users for each country.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">mixpanel.slice("key", <start>, <optional limit>)</code> is a built-in function that instructs JQL to strip away key components that don’t fall into [start, limit) interval, coalescing some groups and producing a more coarse grouping.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">This approach can be extended for computing more complex statistics. For example, here is median over a maximum number of events users had in each country:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupByUser</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.country"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">], mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([mixpanel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">slice</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">)], mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">max</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">))</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">numeric_percentiles</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">50</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <blockquote class="[&:not(:first-child)]:_mt-6 _border-gray-300 _italic _text-gray-700 dark:_border-gray-700 dark:_text-gray-400 ltr:_border-l-2 ltr:_pl-6 rtl:_border-r-2 rtl:_pr-6"> <p class="[&:not(:first-child)]:_mt-6 _leading-7">📘 NOTE</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">An important note on data serialization: the query engine is sometimes forced to serialize and transfer collections during transformations using JSON. Complex data types such as functions and dates are not preserved, so you should avoid storing these types in accumulator objects.</p> </blockquote> <h1 class="_mt-2 _text-4xl _font-bold _tracking-tight _text-slate-900 dark:_text-slate-100">JQL Builtins</h1> <p class="[&:not(:first-child)]:_mt-6 _leading-7">We provide a set of useful helper functions for use with the <code class="nextra-code" dir="ltr">groupBy()</code>,<code class="nextra-code" dir="ltr"> groupByUser()</code>, and <code class="nextra-code" dir="ltr">reduce()</code> transformations. These functions are provided by the query engine, so they are available with no extra work to you.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Some of built-in reducers, e.g. <code class="nextra-code" dir="ltr">avg()</code> or <code class="nextra-code" dir="ltr">sum()</code>, compute statistics over numeric collections. Each of the numeric built-in reducers accepts an optional first argument - an accessor - that instructs it how to convert the input object to a numeric value.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">An accessor can be a JavaScript function, a string with a dot-separated property path, or a built-in mapper function, like <code class="nextra-code" dir="ltr">mixpanel.numeric_bucket()</code>.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7">For example, the following query computes the average age of your users:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">avg</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.age"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">This example makes use of the property name accessor to <code class="nextra-code" dir="ltr">mixpanel.reducer.avg()</code> built-in. A custom function could be used too; in the example below, that function computes length of an array property:</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">avg</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">u</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) { </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> u.properties.$campaigns.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">length</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; }));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducercount" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.count()<a href="#mixpanelreducercount" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Count the number of elements in the collection (or group, if passed to groupBy()). For example, you could use groupBy() and this reducer to implement Mixpanel’s Segmentation report.</p> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><strong>Example:</strong></p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// count the number of events between two dates</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-08-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-08-30"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><strong>Result</strong></p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// 15834 total events</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">15834</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// count the number of people of each age</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.age"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">109</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">120</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span> <span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> ...</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducersumaccessor" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.sum(accessor)<a href="#mixpanelreducersumaccessor" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Sum a collection of numeric values together.</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>accessor</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">function</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">Optional property accessor to retrieve a numeric property from the item.</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// compute the total number of notification hits</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">()</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">sum</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">u</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) { </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> u.properties.$campaigns.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">length</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; }));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">11301</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducernumeric_summaryaccessor" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.numeric_summary(accessor)<a href="#mixpanelreducernumeric_summaryaccessor" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Get a numeric summary of a collection. Returns the count, sum, sum of squares, average and standard deviation for a collection of numeric values.</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>accessor</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">function</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">Optional property accessor to retrieve a numeric property from the item.</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// understand page load times</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-10-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-10-02"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors: [{event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">numeric_summary</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'properties.load_time_ms'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// count = 221 events</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// sum(load time) == 32624 milliseconds</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// sum squares = 9199564 ms^2</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[{ </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"count"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">221</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"sum"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">32624</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"sum_squares"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">9199564</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"avg"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">147.61991</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"stddev"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">140.838023</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreduceravgaccessor" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.avg(accessor)<a href="#mixpanelreduceravgaccessor" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Compute the average of a numeric collection. <code class="nextra-code" dir="ltr">avg()</code> is a shortcut replacement for the two-step process: aggregate with <code class="nextra-code" dir="ltr">numeric_summary()</code>, and follow-up with a <code class="nextra-code" dir="ltr">.map()</code> step that computes average.</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>accessor</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">function</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">Optional property accessor to retrieve a numeric property from the item.</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors: [{event:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}]</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">avg</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.load_time_ms"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">148.9087</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducernumeric_percentilesaccessor-percentiles-spec" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.numeric_percentiles(accessor, percentiles spec)<a href="#mixpanelreducernumeric_percentilesaccessor-percentiles-spec" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Compute percentiles of a numeric collection. Note: this built-in samples the numeric stream; it’s output will differ from exact percentile value up to a fixed error bound. The result may also fluctuate between runs.</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>accessor</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">function</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">name of a numeric property or a function that computes number from input.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>percentile</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">number</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">A percentile number, in (0, 100) interval (alternative 1).</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>percentile</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">array</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">Array of percentile numbers (alternative 2).</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Find median page load time</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors: [{event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">numeric_percentiles</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "properties.load_time_ms"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">50</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">118</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Find 90th, 95th, 99th, 99.9th percentiles of page load time.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors: [{event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">numeric_percentiles</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "properties.load_time_ms"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, [</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">90</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">95</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">99</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">99.9</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> [</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"percentile"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">90</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">356</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">},</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"percentile"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">95</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">468</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">},</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"percentile"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">99</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">732</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">},</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"percentile"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">99.9</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1725</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ]</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducerminaccessormaxaccessor" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.min(accessor)/max(accessor)<a href="#mixpanelreducerminaccessormaxaccessor" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Compute minimum (or maximum) element in a numeric collection.</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>accessor</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">function</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">Name of a numeric property, or a function that computes a number from input.</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Find minimum page load time.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors: [{event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">min</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.load_time_ms"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducermin_byaccessormax_byaccessor" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.min_by(accessor)/max_by(accessor)<a href="#mixpanelreducermin_byaccessormax_byaccessor" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Find the element in a collection that gives the minimum (or maximum) value of a numeric property.</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>accessor</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">function</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">Name of a numeric property, or a function that computes a number from input.</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Find the pageview event with lowest load time.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors: [{event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">min_by</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.load_time_ms"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "name"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "distinct_id"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"8bcf7259-5c6c-4b10-9b8a-34148607aa95"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "time"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1437541412000</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "sampling_factor"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "properties"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:{</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "$email"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Sylvia.Harper@outlookx.com"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "$import"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "country"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"MX"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "load_time_ms"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">0</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducertoplimit" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.top(limit)<a href="#mixpanelreducertoplimit" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Limit the response to the top N values of a collection. This function expects the input collection to be of the <code class="nextra-code" dir="ltr">groupBy()</code> format: <code class="nextra-code" dir="ltr">{ "key": [...], "value": <numeric value> }</code>. The output of this function is a collection containing a single item, the list of the top N items.</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>limit</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">integer</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">The number of items to return</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// get the top 3 countries sending any event</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-06-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors:[{event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}]</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.country"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">], mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">top</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">3</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> [</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"USA"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1234</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"MEX"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">678</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"CAN"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">345</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ]</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducerapplygrouplimitslimit-spec" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.applyGroupLimits(limit spec)/<a href="#mixpanelreducerapplygrouplimitslimit-spec" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Limit the response of each group to the top N values of a collection and optionally to the top N values of the entire collection. This function expects the input collection to be of the <code class="nextra-code" dir="ltr">groupBy()</code> format: <code class="nextra-code" dir="ltr">{ "key": [...], "value": <numeric value> }</code>. The output of this function is a collection with the following structure.</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>limits</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">array</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">Array of limits per group.</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>global</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">number</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">limit Maximum number of results to display.</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Get the top events by user, by date, limited to the top 12 results</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({ </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Collect our events</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'2016-01-01'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'2016-01-31'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }) </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Group the events by multiple keys</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"name"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.$email"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"properties.signup_date"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">], mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Sort the results in the desired order by the desired property</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">sortDesc</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'value'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">)</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Limit the results of each group displayed</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">applyGroupLimits</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">], </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">12</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">)</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "login"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "Ralph.Vargas@aolx.com"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "2015-11-29T05:55:40"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">30</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "login"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "Frances.Mendoza@gmailx.com"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "2015-12-12T06:50:28"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">28</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }, </span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic">...</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "View Blog"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "Henry.Murray@gmailx.com"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "2015-12-22T20:14:32"</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">8</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducerobject_merge" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.object_merge()<a href="#mixpanelreducerobject_merge" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Merge a collection of JavaScript objects into a single object. Numeric leaf values are summed.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// alternate way of calculating the same thing as</span></span> <span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// mixpanel.reducer.numeric_summary()</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-10-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-10-02"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event_selectors: [{event: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">map</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">event</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> var</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> load_time_ms </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> event.properties.load_time_ms;</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> count: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> sum: load_time_ms,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> sum_squares: load_time_ms </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> load_time_ms</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">object_merge</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[{ </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"count"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">221</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"sum"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">32624</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"sum_squares"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">9199564</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducerany" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.any()<a href="#mixpanelreducerany" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-10-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-10-02"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">filter</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">e</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) { </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> e.properties.country </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">==</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "US"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">; })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">any</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "name"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"pageview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "distinct_id"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"75a54352-33c9-4606-9d5f-c5eca9b77b5d"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> ...</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelreducernull" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.reducer.null()<a href="#mixpanelreducernull" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Always return null.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Dump distinct ids of users who had events in January 2016.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-31"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> })</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupByUser</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"1f83aed1-63c4-48ec-aa44-91b90fc1917d"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">"value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">},</span></span> <span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> ...</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelnumeric_bucketaccessor-buckets-spec" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.numeric_bucket(accessor, buckets spec)<a href="#mixpanelnumeric_bucketaccessor-buckets-spec" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Bucketize a numeric value by normalizing it to the lower boundary of the bucket it falls into. It is commonly used to reduce the number of distinct keys when aggregating over numeric values.</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>spec</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">array</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">List of bucket boundaries (alternative 1).</td></tr><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>spec</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">object</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">with bucket_size and offset fields specifying regular bucket intervals (alternative 2).</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Bucketize all users into five age groups.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> () {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> [mixpanel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">numeric_bucket</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'properties.age'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, [</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">18</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">30</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">60</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">])],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">539</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1041</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span> <span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic"> ...</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Bucketize all users into regular buckets by event count.</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-10-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2015-10-02"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupByUser</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">())</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> [mixpanel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">numeric_bucket</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'value'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, {bucket_size: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">10</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, offset:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">})],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">422</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "key"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">11</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">],</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">15</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelto_numberaccessor" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.to_number(accessor)<a href="#mixpanelto_numberaccessor" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7">Convert input into a number. mixpanel.to_number() is commonly used when executing numeric aggregations over a collection of mixed non-numeric data. When unable to interpret input as a number, return undefined.</p> <table class="_not-prose _block _overflow-x-auto nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"><thead><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Argument</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Type</th><th class="_m-0 _border _border-gray-300 _px-4 _py-2 _font-semibold dark:_border-gray-600" style="text-align:left">Description</th></tr></thead><tbody><tr class="_m-0 _border-t _border-gray-300 _p-0 dark:_border-gray-600 even:_bg-gray-100 even:dark:_bg-gray-600/20"><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><strong>accessor</strong></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left"><span style="font-family:courier">function</span></td><td class="_m-0 _border _border-gray-300 _px-4 _py-2 dark:_border-gray-600" style="text-align:left">Name of property to convert (or a javascript function).</td></tr></tbody></table> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// Compute the distribution of signup times</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> People</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">()</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> .</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">reduce</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">numeric_summary</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">to_number</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'properties.signup_date'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">)</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ));</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">[</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "count"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">4411</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "sum"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">6369278974417</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "sum_squares"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">9.1971e+21</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "avg"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">1443953519.477896</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> "stddev"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">5988562.937055</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">]</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <h2 id="mixpanelnumeric_bucket" class="_font-semibold _tracking-tight _text-slate-900 dark:_text-slate-100 _mt-10 _border-b _pb-1 _text-3xl _border-neutral-200/70 contrast-more:_border-neutral-400 dark:_border-primary-100/10 contrast-more:dark:_border-neutral-400">mixpanel.numeric_bucket()<a href="#mixpanelnumeric_bucket" class="nextra-focus subheading-anchor" aria-label="Permalink for this section"></a></h2> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">mixpanel.numeric_bucket()</code> can be used to segment events over calendar period, when applied to time property.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-30"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([mixpanel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">numeric_bucket</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'time'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, {bucket_size: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">86400</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> *</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> 1000</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">})],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div> <p class="[&:not(:first-child)]:_mt-6 _leading-7">JQL defines several constants with bucket specs for widely used time bucket boundaries, when applied to milliseconds since Unix epoch.</p> <ul class="[:is(ol,ul)_&]:_my-3 [&:not(:first-child)]:_mt-6 _list-disc ltr:_ml-6 rtl:_mr-6"> <li class="_my-2"> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">mixpanel.daily_time_buckets</code> - buckets for calendar days</p> </li> <li class="_my-2"> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">mixpanel.weekly_time_buckets</code> - buckets for calendar weeks, starting on Monday</p> </li> <li class="_my-2"> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">mixpanel.monthly_time_buckets</code> - buckets for calendar months</p> </li> <li class="_my-2"> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">mixpanel.quarterly_time_buckets</code> - buckets for calendar quarters: Jan - Mar, Apr - Jun, …</p> </li> <li class="_my-2"> <p class="[&:not(:first-child)]:_mt-6 _leading-7"><code class="nextra-code" dir="ltr">mixpanel.annual_time_buckets</code> - buckets for calendar years</p> </li> </ul> <p class="[&:not(:first-child)]:_mt-6 _leading-7">The following is an equivalent of the query above.</p> <div class="nextra-code _relative [&:not(:first-child)]:_mt-6"><pre class="nextra-focus _overflow-x-auto _subpixel-antialiased _text-[.9em] _bg-white dark:_bg-black _py-4 _ring-1 _ring-inset _ring-gray-300 dark:_ring-neutral-700 contrast-more:_ring-gray-900 contrast-more:dark:_ring-gray-50 contrast-more:_contrast-150 _rounded-md" tabindex="0"><code class="nextra-code" dir="ltr"><span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">() {</span></span> <span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> return</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> Events</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> from_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-01"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> to_date: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"2016-01-30"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> }).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">groupBy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">([</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">numeric_bucket</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'time'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, mixpanel.daily_time_buckets)],</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> mixpanel.reducer.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">count</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">());</span></span> <span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre><div class="_opacity-0 _transition [div:hover>&]:_opacity-100 focus-within:_opacity-100 _flex _gap-1 _absolute _right-4 _top-2"><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5 md:_hidden" title="Toggle word wrap" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="currentColor" height="16"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"></path></svg></button><button class="_transition _border _border-gray-300 dark:_border-neutral-700 contrast-more:_border-gray-900 contrast-more:dark:_border-gray-50 _rounded-md _p-1.5" title="Copy code" type="button" data-headlessui-state=""><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" height="16" class="nextra-copy-icon"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4C2.89543 15 2 14.1046 2 13V4C2 2.89543 2.89543 2 4 2H13C14.1046 2 15 2.89543 15 4V5"></path></svg></button></div></div><div class="_mt-16"></div><div class="_mb-8 _flex _items-center _border-t _pt-8 dark:_border-neutral-800 contrast-more:_border-neutral-400 dark:contrast-more:_border-neutral-400 print:_hidden"><a title="Signal" class="nextra-focus _text-gray-600 dark:_text-gray-400 hover:_text-gray-800 dark:hover:_text-gray-200 contrast-more:_text-gray-700 contrast-more:dark:_text-gray-100 _flex _max-w-[50%] _items-center _gap-1 _py-4 _text-base _font-medium _transition-colors [word-break:break-word] md:_text-lg ltr:_pr-4 rtl:_pl-4" href="/docs/reports/apps/signal"><svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" class="_inline _h-5 _shrink-0 ltr:_rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg>Signal</a><a title="Boards" class="nextra-focus _text-gray-600 dark:_text-gray-400 hover:_text-gray-800 dark:hover:_text-gray-200 contrast-more:_text-gray-700 contrast-more:dark:_text-gray-100 _flex _max-w-[50%] _items-center _gap-1 _py-4 _text-base _font-medium _transition-colors [word-break:break-word] md:_text-lg ltr:_ml-auto ltr:_pl-4 ltr:_text-right rtl:_mr-auto rtl:_pr-4 rtl:_text-left" href="/docs/boards">Boards<svg viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" class="_inline _h-5 _shrink-0 rtl:_rotate-180"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></a></div><div class="feedbackCollectorContainer"><div class="feedbackCollectorRoot"><p class="feedbackQuestionTitle">Was this page useful?</p><div class="feedbackButtonContainer"><button class="feedbackButton">Yes<span class="feedbackThumbsUpIcon"><svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><path fill="currentColor" d="M5 9.7a.5.5 0 0 1 .5.5V17a.5.5 0 0 1-1 0v-6.8a.5.5 0 0 1 .5-.5m0-1.5a2 2 0 0 0-2 2V17a2 2 0 0 0 4 0v-6.8a2 2 0 0 0-2-2z"></path><path fill="currentColor" d="M11 4.5A1.5 1.5 0 0 1 12.5 6v2A1.5 1.5 0 0 0 14 9.5h1.8a1.7 1.7 0 0 1 1.7 1.7v4.6a1.7 1.7 0 0 1-1.7 1.7H9.2a1.7 1.7 0 0 1-1.7-1.7v-5.56a4.5 4.5 0 0 0 3-4.24V4.6a.09.09 0 0 1 .1-.1h.4M11 3h-.4A1.6 1.6 0 0 0 9 4.6V6a3 3 0 0 1-3 3v6.8A3.2 3.2 0 0 0 9.2 19h6.6a3.2 3.2 0 0 0 3.2-3.2v-4.6A3.2 3.2 0 0 0 15.8 8H14V6a3 3 0 0 0-3-3z"></path></svg></span></button><button class="feedbackButton">Could be better<span class="feedbackThumbsDownIcon"><svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><path fill="currentColor" d="M17 4.5a.5.5 0 0 1 .5.5v6.8a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5M17 3a2 2 0 0 0-2 2v6.8a2 2 0 0 0 4 0V5a2 2 0 0 0-2-2z"></path><path fill="currentColor" d="M12.8 4.5a1.7 1.7 0 0 1 1.7 1.7v5.56a4.5 4.5 0 0 0-3 4.24v1.4a.09.09 0 0 1-.1.1H11A1.5 1.5 0 0 1 9.5 16v-2A1.5 1.5 0 0 0 8 12.5H6.2a1.7 1.7 0 0 1-1.7-1.7V6.2a1.7 1.7 0 0 1 1.7-1.7h6.6m0-1.5H6.2A3.2 3.2 0 0 0 3 6.2v4.6A3.2 3.2 0 0 0 6.2 14H8v2a3 3 0 0 0 3 3h.4a1.6 1.6 0 0 0 1.6-1.6V16a3 3 0 0 1 3-3V6.2A3.2 3.2 0 0 0 12.8 3z"></path></svg></span></button></div></div></div></main></article></div><footer class="_bg-gray-100 _pb-[env(safe-area-inset-bottom)] dark:_bg-neutral-900 print:_bg-transparent"><div class="_mx-auto _flex _max-w-[90rem] _gap-2 _py-2 _px-4 _hidden"><button title="Change theme" class="_h-7 _rounded-md _px-2 _text-xs _font-medium _transition-colors _text-gray-600 dark:_text-gray-400" id="headlessui-listbox-button-:R6st6:" type="button" aria-haspopup="listbox" aria-expanded="false" data-headlessui-state=""><div class="_flex _items-center _gap-2 _capitalize"><svg fill="none" viewBox="3 3 18 18" width="12" height="12" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" fill="currentColor" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path></svg><span class="">Light</span></div></button></div><hr class="dark:_border-neutral-800"/><div class="_mx-auto _flex _max-w-[90rem] _justify-center _py-12 _text-gray-600 dark:_text-gray-400 md:_justify-start _pl-[max(env(safe-area-inset-left),1.5rem)] _pr-[max(env(safe-area-inset-right),1.5rem)]">© Mixpanel 2024</div></footer></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/docs/reports/apps/jql","query":{},"buildId":"61ktskimPr4Fk1_DjRZix","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script><script async="" src="https://widget.kapa.ai/kapa-widget.bundle.js" data-website-id="099b7303-a981-443f-9ec7-4aebdc466fb4" data-project-name="Mixpanel" data-modal-title-ask-ai="Mixpanel Ask AI" data-modal-title-search="Mixpanel Search" data-search-mode-enabled="true" data-search-result-link-target="_self" data-project-color="#1b0b3b" data-modal-disclaimer="This is a custom LLM for Mixpanel with access to all developer documentation and API references, blogs, and YouTube content. Please note that answers are generated by AI and may not be fully accurate, so please use your best judgement." data-project-logo="https://cdn.mxpnl.com/marketing-site/latest-rc/image/external/mixpanel-dark-purple-brand-mark-2x.png" data-modal-example-questions-col-span="6" data-modal-open-on-command-k="true" data-modal-example-questions="What is the first event I should track?,How do I migrate off Google Analytics?,How do I calculate time spent?,How do I import Snowflake data?" data-modal-override-open-class-search="top-nav-search-bar" data-search-include-source-names="["Documentation", "Guides"]" data-search-source-group-order="["Documentation", "Guides"]" data-modal-command-k-search-mode-default="true" data-modal-header-bg-color="#f5f2f2" data-switch-bg-color="#f5f2f2" data-switch-color="1b0b3b" data-modal-header-border-bottom="2px solid #eae7e7" data-search-result-primary-text-color="#1b0b3b" data-search-result-secondary-text-color="#626266" data-search-result-badge-bg-color="#eae7e7" data-search-result-badge-text-color="#626266" data-query-input-text-color="#1b0b3b" data-button-bg-color="#7856FF" data-modal-overlay-opacity="0.8" data-modal-overlay-bg-color="#242133"></script><script>(function(){let k=window.Kapa;if(!k){let i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};window.Kapa=i}})();</script><script> </script></body></html>