Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ The complete list of configurable parameters that can be configured via `userale
| logDetails | Toggle detailed logs (keys pressed and input/change values) | false |
| resolution | Delay between instances of high frequency logs (mouseover, scroll, etc.) | 500 (ms) |
| userFromParams | Query param in the page URL to fetch userId from | null |
| toolName | Name of tool being logged | null |
| toolName | Name of tool being logged | null (but required) |
| authHeader | Authorization header to be passed to logging endpoint | null |

If you have included UserALE.js as a `script-tag` in your project, you can use HTML data parameters to pass configuration options to the library through the script tag. For example:
Expand All @@ -147,6 +147,7 @@ If you have included UserALE.js as a `script-tag` in your project, you can use H
src="./node_modules/flagon-userale/build/userale-2.4.0.min.js"
data-url="http://localhost:8000/"
data-user="example-user"
data-toolName="sample-app"
data-version="2.4.0"
data-tool="Apache UserALE.js Example"
></script>
Expand All @@ -165,7 +166,7 @@ You have access to the same parameters listed above, however, naming conventions
| data-log-details | Toggle detailed logs (keys pressed and input/change values) | false |
| data-resolution | Delay between instances of high frequency logs (mouseover, scroll, etc.) | 500 (ms) |
| data-user-from-params | Query param in the page URL to fetch userId from | null |
| data-tool | Name of tool being logged | null |
| data-toolName | Name of tool being logged | null (but is required) |
| data-auth | Authorization header to be passed to logging endpoint | null |

If you are using our [WebExtension](https://github.com/apache/flagon-useralejs/tree/master/src/UserALEWebExtension),
Expand Down
3 changes: 2 additions & 1 deletion src/UserALEWebExtension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var config = {
version: null,
resolution: 500,
time: timeStampScale({}),
toolName: "browser-plugin",
on: true,
};
var sessionId = 'session_' + Date.now();
Expand Down Expand Up @@ -96,7 +97,7 @@ function packageBrowserLog(type, logDetail) {
'details' : logDetail,
'userId' : globals.toolUser,
'toolVersion': null,
'toolName': null,
'toolName': "browser-plugin",
'useraleVersion': null,
'sessionID': sessionId,
});
Expand Down
2 changes: 1 addition & 1 deletion src/UserALEWebExtension/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
export var userAleHost = 'http://localhost:8000';
export var userAleScript = 'userale-2.4.0.min.js';
export var toolUser = 'nobody';
export var toolName = 'test_app';
export var toolName = 'browser-plugin';
export var toolVersion = '2.4.0';

/* eslint-enable */
6 changes: 6 additions & 0 deletions src/getInitialSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function getInitialSettings() {
const get = script ? script.getAttribute.bind(script) : function () {
return null;
};

settings.autostart = get('data-autostart') === 'false' ? false : true;
settings.url = get('data-url') || 'http://localhost:8000';
settings.transmitInterval = +get('data-interval') || 5000;
Expand All @@ -51,6 +52,11 @@ export function getInitialSettings() {
settings.sessionID = get('data-session') || sessionId;
settings.authHeader = get('data-auth') || null;
settings.custIndex = get('data-index') || null;

if (settings.toolName === null || settings.toolName === "") {
throw "Please set the tool name before use.";
}

return settings;
}

Expand Down