Javascript Monitoring API - Complete Examples of Data Collection from an External Site
Settings in LumisXP
Before running one of the examples, some settings must be made in the LumisXP installation so that the examples can be executed correctly.
For these settings, it is assumed that the examples will be accessed via the URL http://localhost:3000
in the browser.
These settings are described below.
Registration of CORS Rules
It is necessary to include two new CORS rules.
The first is for the Javascript file track.js
from the Javascript Monitoring API
to be correctly included in the site:
This rule must be:
- Position
1
- Request Origin Pattern
http://localhost:3000
- Request Path Pattern
/lumis/portal/monitor/script/track.js
- Allowed Methods in Request
GET
- Allowed Headers
DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-LUM-MONUID
- Allows Credential Sending
Yes
- Exposed Headers in Request
Content-Length,Content-Range
- Max Age of CORS Information Cache
1,800
Another rule must be added so that the Javascript Monitoring API can call its REST endpoints.
This rule must be:
- Position
2
- Request Origin Pattern
http://localhost:3000
- Request Path Pattern
/lumis/api/rest/lumis/monitor/v1/.*
- Allowed Methods in Request
*
- Allowed Headers
DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-LUM-MONUID
- Allows Credential Sending
Yes
- Exposed Headers in Request
Content-Length,Content-Range
- Max Age of CORS Information Cache
1,800
Example of Data Collection from an External Site Using Pure Javascript
This example aims to demonstrate how data collection from an external site can be performed using pure Javascript.
To access the code for this example, see this page.