Table of Contents


Chat Plug-ins or Tracking scripts

You may be required to use a script that is provided by a third party chat plugin or to use tracking scripts to monitor portal activities. In such cases, you will need the script to be deployed to all the pages of the portal.

Magentrix "Theme Builder" can help you easily configure these scripts for your portals.

Follow the steps below in order to copy/paste your script:

  1. Open the "Theme Builder".
  2. At the top left of the page, click on the "Gear" icon "Theme and Settings".
  3. Click on the menu dropdown icon in the heading pane to open the menu options.
  4. Click on "JS".
     
Warning: Do not use this feature to alter Magentrix code or pages. Magentrix cannot guarantee that future upgrades will not impact such customizations.

jQuery is not guaranteed to be loaded on every page and will conflict with our platform Iris runtime.
To avoid missing‑dependency errors and library clashes, do not use or import jQuery in your custom scripts.
Please write in vanilla JavaScript instead.

Simply paste your code and check the "Enabled" checkbox and then click "Apply". Note that you can paste your code and click on "Apply", but the scripts will not be deployed until you check the "Enabled" checkbox.

Also, note that the script will be applied to all pages of the portal for all the users - even pages that are publicly accessed (when no one is logged in). Therefore, it is important to consider your use case and determine the best way to use the scripts as intended.

Magentrix provides you with a set of environmental variables that you can reference in your JavaScript code in order to better control and integrate Magentrix with your third-party plug-ins.

Use the "$systemInfo" object to access various data about the current user and portal information.

Below are some examples of properties available:

// Unique ID of the current user
var userId = $systemInfo.userId;

// Determines if the user is a guest user (no one is logged-in).
var isGuestUser = $systemInfo.guest;

// user's role
var role = $systemInfo.role;

// user's role type, for example: "customer", "partner", "guest", "employee" or "admin"
var roleType = $systemInfo.roleType;