Start typing to search...

Use Koji plugins

A plugin is software that can be added to a Koji app after publication to provide additional functionality. Basically, it allows for the injection of dynamic code. Plugins can only be added by the creator of an app. So, if you create a customized version of an app that uses a plugin, you will have to add the plugin to the new version. It will not be passed down to the customized app automatically.

Generally, a creator customizes a plugin for a particular app by specifying values for one or more fields. For example, a creator can specify the tracking ID for the Google Analytics plugin.

Advantages of plugins

In addition to allowing the creator to easily add functionality to a Koji app, plugins offer a few other advantages.

  • Search engines and social crawlers often do not render JavaScript when indexing pages. For instance, if you’re using React, a bot may only see the root div and an "enable JavaScript" message. A plugin can overcome this limitation by injecting keywords into a webpage’s header. Because Koji plugins are computed server-side, they are available to all bots without any additional configuration or third-party services.

  • A plugin can inject a new file at runtime, simplifying the creation of things like web app manifests. The plugin provides configurable values, and the injection wraps them with the relevant code.

Limitations

  • Koji plugins are not designed to modify app functionality or to inject code that interfaces with an app’s native code. This is an intentional decision to avoid code fragmentation. Meaningful changes to functionality should be done within the code of the app, and repeated core behaviors should leverage JavaScript packages and the larger JavaScript community.

  • Plugins are only injected into static services.

  • If your app contains multiple static services, plugins will be injected into all of them. There is no way to enable or disable plugins on a per-service basis.

Enabling a plugin for your Koji app

  1. Open the app and go to App  …​  Plugins.

  2. Choose a plugin from the list of available plugins.

  3. Configure and enable the plugin.