Custom Scripts

Who can use this feature?

👤 Available on Enterprise plans

Custom Scripts allow you to bring in specific functionality and customizations that aren’t available natively in Stacker. For example, you can add a custom script for Google Analytics to learn about how your customers are using your Stacker app, or you could integrate with Weglot to translate your app into a different language.

This feature needs to be toggled on by a Workspace Owner. If you’re an app admin you’ll need to ask your workspace owner to enable this feature

Add a Custom Script

  1. Click App Settings

  2. Click General

  3. Click Custom Scripts

  4. Paste your custom script in the relevant box to Run Once or Per page change

  5. Enclose your script in script tags: <script> </script> comments can be included as well <!-- -->

  6. Click Save

Scripts to run once

  • The run once scripts run when the app component is mounted. In other words, when the app loads up for the first time, or the whole app is reloaded.

  • Scripts to be run once include Google Analytics and Google Tag Manager.

Scripts to run per page change

  • Whenever the URL changes, but the whole app doesn’t reload. This is noticeable by the app bar and navigation bar not disappearing.

  • Example of scripts to be run per page: FreshChat, Front App, Pendo and Weglot.

Allow admins to add Custom Scripts to apps

  1. Click Workspace Settings

  2. Click Advanced

  3. Find Enable self-serve custom scripts

  4. Select Everyone in the dropdown

  5. Click Save

App admins will now be able to add custom scripts to any app in your Workspace.

Security Considerations

Allowing app admins to insert custom scripts gives your admins a lot of flexibility to expand an app’s functionality and customizations. But there are some security implications you need to be aware of.

Custom scripts give you the power to execute arbitrary code in the browsers of anyone using the app where the code has been added.

That means the code has the potential to access any data that a user has access to in Stacker – including in other Stacker apps, and other workspaces the user is a member of.

In addition, it is theoretically possible to insert a script that breaks your app and makes your app unusable.

If you’re unsure about a script you’re considering adding to your apps, reach out to your Customer Success Manager to find out more.

Stacker doesn’t vet the scripts that are inserted into apps, so it is up to individual workspace owners to check any scripts inserted into apps in their workspaces themselves.

Last updated