# Site Configuration
GRAVITY uses concept of ‘Sites' to make distinguish between different applications or different modules of an application and let them have different configuration settings and give ‘Author’ permissions only for users responsible for the module or a site (see: [[User Roles]]).
# Site mapping
The ‘site mapping’ defines on which web pages the site configuration applies (Figure 1). Like in other configurations, GRAVITY uses ‘Expressions’ to creates Rules which define when GRAVITY should be activated and visible.
![[site-config-site-mapping-1-8.png]]
Figure 1
The types of an URL can also vary between:
- ‘DOMAIN’ - all the pages of the defined DOMAIN
- ‘STARTS_WITH’ - all the pages URL of which starts with the value defied
- ‘PAGE’ - only on a particular page and exact URL of that page should be defined
If you don't want GRAVITY to load on some of the pages in your site, you can configure it to ignore those pages.
![[site-mapping-1.png]]
Figure 2
In addition to the common pattern types, there are specific ones that can only be used for Ignore list:
- ‘CONTAINS_IN_PARAMS' - a key=value pair of query parameters used in the URL.
For example, the pattern 'config=true’ will skip loading of GRAVITY on pages such as ``https://site.com/users/list?config=true&sortBy=name``
- CONTAINS_IN_PATH - a string which is a sub-path of the URL
For example, the pattern 'editone’ (in Figure 3) will skip loading of GRAVITY on pages such as ``https://site.com/users/editone``
- HAS_ATTRIBUTE - applies only to IFrames and allows to skip loading GRAVITY on all IFrames (pattern 'iframe'), or only on IFrames with a certain class (``'class="wysiwyg_editor_cls"``), or on IFrames with the defined key=value pair of HTML attributes (``'id="login_frame"', 'frameborder="0"'`` or similar).
![[site-mapping-2.png]]
Figure 3
> [!info] Running into issues?
> Check the troubleshooting guide: [[#Problem No GRAVITY control]]
> Also see: [[Debugging GRAVITY]]
# Hotspot mapping
If a Hotspot is saved, GRAVITY takes the URL and applies rules to it who defines when that hotspot should be displayed. How hotspots interact with the site is not always the same for each application. Therefore, GRAVITY can be configured to fit a wide range of use cases. At the tab ‘Hotspot mapping’ the configuration can be defined, and rules can be built for such use cases. There are multiple configurations, so called ‘Expressions’ allowed, and GRAVITY will try to apply them from the top to bottom.
Once a user saves a hotspot, GRAVITY uses the first expression who matches the combination of URL, template settings and regular expression. The value determined will be stored as ‘Calculated mapping’ and used to display to the user in case he has the combination of URL and configuration in his web application.
![[site-config-hotspot-mapping-1-1.png]]
Figure 1
If you have multiple expressions, you can review which expression was assigned to a certain URL through the ‘Test’ at the bottom of the tab ‘Hotspot mapping’ (Figure 1). Expression ‘0’ would be the first/top expression on the configuration list going downward.
![[site-config-hotspot-mapping-1-2.png]]
Figure 2
The first expression in Figure 2 is of type ‘`PATH`’ and only applied to hotspots which are NOT (`false`) marked as templates. A hotspot can be marked as template in Callout Edit mode step 2.
The type ‘`PATH`’ saves everything except the domain of the URL.
The effect of this ‘hotspot mapping’ configuration on each hotspot can be monitored under the ‘Hotspots’ (Figure 3). In the screen shot Figure 3, the callout “Home-Assistant” is NOT marked as Template therefore the ‘Mapping’ is bound to the URL “`/lightning/page/home`”.
![[site-config-hotspot-mapping-1-3.png]]
Figure 3
If the template option IS check in edit mode, the callout should be visible everywhere where the ‘PATH’ occurs. In that case the ‘Mapping’ would be ‘`GLOBAL`’ for that PATH (Figure 4)
![[site-config-hotspot-mapping-1-4.png]]
Figure 4
The second expression in the example (Figure 2) is of type ‘`REGEX`’ (Regular Expression) and contains the expression:
`(.[^/]+)/lightning/r/(.[^/]+)/(.[^/]+)/view` and template is ‘`true`’
That expression is be used to display template hotspots in a special occasion. What the regular expression express means is that, if an URL contains ``/lightning/r/`` and ``/view`` save the Hotspot’s URL but ignoring the part in between. In that case GRAVITY replaces these parts with place holders.
Figure 5 shows the such a use case. A hotspot should be placed on the tab ‘Activity’ and should be showed only when back in ``/lightning/r/`` and ``/view`` state.
![[site-config-hotspot-mapping-1-5.png]]
Figure 5
Otherwise that hotspot would be shown only on the particular opportunity it was originally created. You might see the difference in Figure 6.
![[site-config-hotspot-mapping-1-6.png]]
Figure 6
The third and last expression in the example (Figure 2) is of type ‘`CONST`’ and contains the expression:
`.*` and template is ‘`true`’
That expression is fetching all cases in which the first two expression where not applied and assign ‘`Global`’ mapping to it (Figure 7).
![[site-config-hotspot-mapping-1-7.png]]
Figure 7
In summary what happened in that ‘Hotspot mapping’ in Figure 2:
n summary what happened in that ‘Hotspot mapping’ in Figure 2:
| Expression | Case | Result |
| ---------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0 | The Hotspot is not marked as template | Save the precise URL and display the Hotspot only when that exact URL is displayed. |
| 1 | The Hotspot is marked as template and the URL contains ``/lightning/r/`` and ``/view`` | Save the URL with placeholder between ``/lightning/r/`` and ``/view`` and display the Hotspot wehen ``/lightning/r/`` and ``/view`` are in the URL |
| 2 | The Hotspot is marked as template | Save the Hotspot with the value ``GLOBAL`` and display it in all occasions where defined in ‘Site mapping’. |
# Navigation mapping
Configuration defined on ‘Navigation mapping' tab is used by GRAVITY to calculate URL of the target web page and let users jump directly to the page where corresponding callout is available.
Such navigation to another page is useful when a workflow is placed on multiple pages and there is no element of the target application which allows to navigate to another page, or if a user wants to jump to a callout from the Dashboard.
If a target application uses dynamics URLs which contain object identifiers and other dynamic information configuration of navigation mapping is hardly possible. Therefor recommended solution is to do not add any rules there, which simply will disable navigation actions for end users to avoid redirects to not-existing or protected pages.
For applications with static URLs, the preferred option is ‘**ABSOLUTE**', i.e. use exact URL of the page where a callout was added initially.
’**REGEXP**' option is useful for applications which have user’s identifier or other session-related information as a part of URLs. I.e. all the the regular expression groups of the current session will replace the corresponding groups in the initial callout’s URL.
![[navigation-mapping-1.png]]
'**DOMAIN**' rule helps in case if GRAVITY content is mirrored between UAT and production instances and even if a callout was initially created in the UAT instance users need to be redirected to the corresponding page in the production environment.
‘Expression' field can be used to apply the rule only for specific URLs. For example, if a user is working on page from UAT environment there might be a reason to do not do redirect to the production instance. In such configuration 'Mapping value’ could be empty, i.e. use the initial URL, or can be set to domain of the UAT instance, meaning force navigation to UAT page.
![[navigation-mapping-2.png]]
'**PAGE**' rule allows to redirect all the navigation requests to a specific page, for example to a knowledge base of the target application.
![[navigation-mapping-3.png]]
>[!info] Running into issues?
> Check the troubleshooting guide: [[#Problem Workflow step URL can’t be calculated]]
> Also see: [Debugging GRAVITY](app://obsidian.md/Debugging%20GRAVITY)
## Problem: No GRAVITY control
You are using script injection to inject GRAVITY into a page, but when the page loads, you don't see the GRAVITY control and there is a message in the browser console
![[missing-site-configuration-1.png]]
or there is a 404 response with "site.not.found" as the error key
![[missing-site-configuration-2.png]]
### Solution
In most cases this problem is caused by missing site configuration in the Admin site.
I.e. GRAVITY is injected on a URL, but there is no corresponding site configured on our backed and there is no configuration available for that site.
All you have to do is configure the [[#Site mapping]] for one of the sites so that GRAVITY will load properly.
## Problem: Workflow step URL can’t be calculated
GRAVITY can't calculate where the next workflow step should be. If that happened, content authors, see error message and GRAVITY can’t proceed the workflow.
![[workflow-step-cant-be-calculated-1.png]]
If target application URLs are too dynamic, GRAVITY can’t calculate where the users should be navigated. If such a case occurs, the user is informed that the workflow can’t proceed, and he should contact the support team. The workflow navigation must be configured in the GRAVITY admin site (see: [[#Navigation mapping]]).
### Solution 1
Double check the [[#Navigation mapping]] workflow settings in GRAVITY Admin. If you are unsure about the settings, please contact [[Help and Support]].
![[workflow-step-cant-be-calculated-2.png]]
### Solution 2
Find a suitable target element, for the workflow step who is interrupting your workflow. Use the provide hints by GRAVITY who are indicating such optimal elements.
![[workflow-step-cant-be-calculated-3.png]]
### Solution 3
Split the workflow in question to two workflows. Describing each page separately. Use prefix in workflow names to logically connect them for your users.