Self-hosting Command AI
We like to get philosophical here at Command AI. Before talking about how to self-host Command AI, let’s talk about what self-hosting actually means.
There are 3 components to installing Command AI inside an application:
- Library: the code that Command AI needs to run
- Config: the specification of a customer’s experiences. Nudges, pages, all that good stuff.
- Analytics: where analytics events should be sent.
There is a self-hosting option for each component.
Library
The Command AI library refers to the code needed to run Command AI’s experiences for end users on the client side.
There are two options for hosting the Command AI library:
- [Default] Cloud-hosted: using this option, the latest version of Command AI (which we thoroughly test and QA before deploying to our customers) will be delivered to the client-side on page load, distributed via Command AI’s CDN for fast load times.
- This method ensures you and your users receive our latest updates and features.
- Note: this method requires an API request to the Command AI API. This request can be proxied behind your company’s API so that requests to https://api.command.ai will be hidden from your client-side.
- We have an impressive availability record, which you can see here.
- Bundled: when we ship updates to our product, we also publish those updates to a JavaScript Library (here). Enterprise customers can optionally use this library instead of our cloud-hosted library.
- This means that no API request is required to load Command AI, making this approach suitable for airgapped environments.
- This requires customer engineers to upgrade the Command AI library manually to ensure access to new features.
Config
The Command AI config refers to the experiences customers create with Command AI.
There are three options for hosting the Command AI config:
- [Default] Cloud-hosted: using this option, configuration changes will be hosted on Command AI servers and deployed to the client at run-time. This facilitates a no-code deploy experience. A change can be made to your config and immediately made available to customers.
- Note: this method requires an API request to the Command AI API. This request can be proxied behind your company’s API so that requests to https://api.command.ai will be hidden from your client-side.
- Customer-hosted: a customer can export their Command AI config as a
.json
file and host that file in a static server controlled by the company. This approach eliminates a dependency on the Command AI API, but requires someone at the customer to manually update the config file when changes wish to be made.- Note: when this method is used, certain targeting rules which rely on access to the Command AI API will be unavailable.
- Customer-bundled: a customer can export their Command AI config as a
.json
file and bundle it along with the Command AI library into their production code. This eliminates any need for an API request to load the config, and is suitable for airgapped environments.
Analytics
Analytics refers to the destination for events generated from end-user usage of Command AI, like nudge clicks and command usage
There are three options for Command AI’s analytics destination, and they are not mutually exclusive.
- [Default] Store with Command AI: using this approach, analytics events are stored on a Command AI database keyed using the anonymous user
id
provided toCommandBar.boot
in the customer’s install script. This method gives customer immediate access to analytics dashboards at https://app.command.ai. - Analytics integrations: Command AI has integrations with many analytics providers, including Amplitude, Segment, and Heap. Turning on these integrations sends Command AI-generated events to these destinations. Note that these integrations are proxied by the Command AI API, and require an API request (which can optionally be proxied through a customer’s API).
- Custom destination: Customers can choose a custom destination for analytics events and route those events to that destination on the client-side using
CommandBar.addEventSubscriber
. You can read more about this SDK method here.
In addition, it is possible to turn off analytics completely. This approach is not recommended (because it hampers customers’ ability to iterate on and learn from engagement with Command AI experiences). However, this may be most suitable for airgap environments.