Code Injecting

Learn how to inject code into your app

You can inject custom code into the apps, this is useful if you’d like to customize the design or functionality of your app without affecting the website.

To use code injecting you will need to edit your app’s advanced configuration.

Notion Image

This is how the code injecting feature will be configured by default:

"Code_Injecting": {
    "Enable_Injecting": false,
    "Code_Injecting_Items": [
      {
        "Regex": "",
        "Code": ""
      }
    ]
  },

If your configuration looks different than that you might have an old version in place, feel free to replace your code injecting related code with the one above to ensure everything will work properly in your app.

Let’s break down each parameter:

Enable_Injecting (true/false)

Determines if code injecting should be active or not. In order to use this feature you will need to set the value to “true”.

Code_Injecting_Items (array)

Each item added to the Code_Injecting_Items will allow you to inject a different piece of code into your website.

You might want to use different items when targeting specific URLs. You might for example want to have code #1 injected on your home page only, while code #2 injected on all other pages.

Regex (regex)

Determines where your code will be injected.

When a page is loaded in your app and you have the code injecting feature turned on, the app will perform a check on the URL of that page using the regex provided. If there is a match, the code will be injected.

If you want the code to be injected into all pages you can use the following:

"Regex": ".*"

Code (HTML)

The code parameter is where you will want to add your HTML code that should be injected into your page(s).

If you want to add custom CSS you can use the following:

"Code": "<style>.your-class { display:none !important; }</style>"

If you want to add custom Javascript you can use the following:

"Code": "<script>alert('code injected');</script>"

Final Code

Your final code should look as follows when using the code injecting feature:

"Code_Injecting": {
    "Enable_Injecting": true,
    "Code_Injecting_Items": [
      {
        "Regex": ".*",
        "Code": "<style>.your-class { display:none !important; }</style>"
      }
    ]
  },