Overview
The Members Portal exposes three injection points that let operators add custom code without modifying the portal source:
All three files are edited from the Web Template Editor in your Nexudus dashboard at Settings > Website > Web Template Editor > Built-in Files.
Editing the files
1
Open the Web Template Editor
Go to Settings > Website > Web Template Editor and select the Built-in Files tab.
2
Select a file
Click
app.js, styles.css, or head.js depending on which injection point you want to customise.3
Edit and save
Make your changes in the code editor and click Save. Changes take effect immediately on the next portal page load — no rebuild required.
styles.css — Custom CSS
Anything you write instyles.css is injected verbatim inside a <style data-nx-custom="css"> tag appended to <head>. Use it to override default portal styles or add entirely new rules.
Targeting embedded (iframe) mode
When the portal is loaded inside an iframe (e.g. via widget embedding), the<html> element automatically receives the in-iframe class. Use it in styles.css to apply styles only when the portal is embedded:
Targeting authentication and membership status
The portal automatically toggles classes on the<html> element based on the current user’s authentication and membership state:
These classes update reactively — when a user signs in or out, or their membership status changes, the classes are toggled immediately.
app.js — Custom JavaScript
Code inapp.js runs exactly once, after the portal mounts. It executes in the context of the portal page, so it has full access to the DOM and to the window.__nexudus object (see below).
head.js — Custom head elements
head.js must contain a JSON array of element descriptors. Each object must have a type field (case-insensitive) set to one of:
scriptmetalinkstylenoscript
<head> in the order they appear in the array. If the JSON is invalid or an element uses a disallowed type, that element is silently skipped.
The window.__nexudus object
Before app.js executes, the portal populates window.__nexudus with live application state. The object is kept up to date on every render, so values read at any time reflect the current portal state.
__nexudus.settings
Provides access to the current location’s configuration.
canAccessSection access levels
The setting value is a numeric code that maps to one of these access levels:
Returns
false for any other value or when the user does not meet the required level.
business fields
checkoutTypes fields
__nexudus.location
Provides access to the current location context, including the list of businesses and HTTP clients for making API calls.
__nexudus.auth
Contains the current authentication state and the signed-in customer’s data.
Commonly used coworker fields
__nexudus.router
Provides access to the portal’s client-side router so custom code can read the current URL or navigate programmatically.
Examples
Add Google Tag Manager
Inhead.js:
Show a banner only to customers without an active plan
Inapp.js:
Redirect a specific setting-based feature flag
Inapp.js:
Run code on specific pages and react to navigation
The portal is a single-page application.app.js runs once on initial mount — it does not re-execute when members navigate between pages. To run code whenever the route changes, patch history.pushState and history.replaceState and listen for the popstate event (which fires on browser back/forward).
In app.js:
window.location inside onRouteChange — window.__nexudus.router.location is a snapshot from portal mount and is not updated by client-side navigation.
React to changes in a __nexudus value
window.__nexudus is a snapshot from portal mount — its plain value properties (auth.*, router.location, etc.) are not automatically updated as the portal state changes. To react when a value changes, poll it with setInterval and compare against the previous reading.
The helper below wraps that pattern and returns a cancel function so you can stop watching when it is no longer needed.
In app.js:
Apply a CSS custom property from a business setting
Inapp.js:
styles.css:
Load a custom Google Font
Usehead.js to preconnect and load the font stylesheet, then apply it in styles.css.
In head.js:
styles.css:
Redirect users to their home location
In a multi-location network, you may want users who land on the top-level (parent) location to be automatically redirected to their home location — the location where they are invoiced. Add this script to theapp.js of the parent location only (the one you want to redirect users away from).
The script:
- Checks if the user is on the root page of the current location.
- Verifies the user is authenticated.
- Looks up the user’s home location (based on their
InvoicingBusinessId). - Navigates them to that location’s portal page if it differs from the current one.
app.js: