mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:21:16 +02:00
Some initial analytics for PAL usage
This commit is contained in:
parent
601223aa98
commit
d9fbf832e2
5 changed files with 34 additions and 1 deletions
|
@ -247,6 +247,7 @@ Rectangle {
|
||||||
userModel.setProperty(model.userIndex, styleData.role, newValue)
|
userModel.setProperty(model.userIndex, styleData.role, newValue)
|
||||||
userModelData[model.userIndex][styleData.role] = newValue // Defensive programming
|
userModelData[model.userIndex][styleData.role] = newValue // Defensive programming
|
||||||
Users[styleData.role](model.sessionId, newValue)
|
Users[styleData.role](model.sessionId, newValue)
|
||||||
|
UserActivityLogger["palAction"](newValue ? "un-" + styleData.role : styleData.role, model.sessionId)
|
||||||
if (styleData.role === "ignore") {
|
if (styleData.role === "ignore") {
|
||||||
userModel.setProperty(model.userIndex, "personalMute", newValue)
|
userModel.setProperty(model.userIndex, "personalMute", newValue)
|
||||||
userModelData[model.userIndex]["personalMute"] = newValue // Defensive programming
|
userModelData[model.userIndex]["personalMute"] = newValue // Defensive programming
|
||||||
|
@ -273,6 +274,7 @@ Rectangle {
|
||||||
height: 24
|
height: 24
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Users[styleData.role](model.sessionId)
|
Users[styleData.role](model.sessionId)
|
||||||
|
UserActivityLogger["palAction"](styleData.role, model.sessionId)
|
||||||
if (styleData.role === "kick") {
|
if (styleData.role === "kick") {
|
||||||
// Just for now, while we cannot undo "Ban":
|
// Just for now, while we cannot undo "Ban":
|
||||||
userModel.remove(model.userIndex)
|
userModel.remove(model.userIndex)
|
||||||
|
|
|
@ -1937,6 +1937,8 @@ void Application::initializeUi() {
|
||||||
rootContext->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data());
|
rootContext->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data());
|
||||||
rootContext->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());
|
rootContext->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());
|
||||||
|
|
||||||
|
rootContext->setContextProperty("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
|
||||||
|
|
||||||
rootContext->setContextProperty("Camera", &_myCamera);
|
rootContext->setContextProperty("Camera", &_myCamera);
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
|
|
|
@ -38,6 +38,21 @@ void UserActivityLoggerScriptingInterface::tutorialProgress( QString stepName, i
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserActivityLoggerScriptingInterface::palAction(QString action, QString target) {
|
||||||
|
QJsonObject payload;
|
||||||
|
payload["action"] = action;
|
||||||
|
if (target.length() > 0) {
|
||||||
|
payload["target"] = target;
|
||||||
|
}
|
||||||
|
logAction("pal_activity", payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserActivityLoggerScriptingInterface::palOpened(float secondsOpened) {
|
||||||
|
logAction("pal_opened", {
|
||||||
|
{ "seconds_opened", secondsOpened }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void UserActivityLoggerScriptingInterface::logAction(QString action, QJsonObject details) {
|
void UserActivityLoggerScriptingInterface::logAction(QString action, QJsonObject details) {
|
||||||
QMetaObject::invokeMethod(&UserActivityLogger::getInstance(), "logAction",
|
QMetaObject::invokeMethod(&UserActivityLogger::getInstance(), "logAction",
|
||||||
Q_ARG(QString, action),
|
Q_ARG(QString, action),
|
||||||
|
|
|
@ -25,7 +25,8 @@ public:
|
||||||
Q_INVOKABLE void toggledAway(bool isAway);
|
Q_INVOKABLE void toggledAway(bool isAway);
|
||||||
Q_INVOKABLE void tutorialProgress(QString stepName, int stepNumber, float secondsToComplete,
|
Q_INVOKABLE void tutorialProgress(QString stepName, int stepNumber, float secondsToComplete,
|
||||||
float tutorialElapsedTime, QString tutorialRunID = "", int tutorialVersion = 0, QString controllerType = "");
|
float tutorialElapsedTime, QString tutorialRunID = "", int tutorialVersion = 0, QString controllerType = "");
|
||||||
|
Q_INVOKABLE void palAction(QString action, QString target);
|
||||||
|
Q_INVOKABLE void palOpened(float secondsOpen);
|
||||||
private:
|
private:
|
||||||
void logAction(QString action, QJsonObject details = {});
|
void logAction(QString action, QJsonObject details = {});
|
||||||
};
|
};
|
||||||
|
|
|
@ -208,6 +208,7 @@ pal.fromQml.connect(function (message) { // messages are {method, params}, like
|
||||||
var id = overlay.key;
|
var id = overlay.key;
|
||||||
var selected = ExtendedOverlay.isSelected(id);
|
var selected = ExtendedOverlay.isSelected(id);
|
||||||
overlay.select(selected);
|
overlay.select(selected);
|
||||||
|
UserActivityLogger.palAction("avatar_selected", id);
|
||||||
});
|
});
|
||||||
|
|
||||||
HighlightedEntity.clearOverlays();
|
HighlightedEntity.clearOverlays();
|
||||||
|
@ -232,14 +233,17 @@ pal.fromQml.connect(function (message) { // messages are {method, params}, like
|
||||||
case 'refresh':
|
case 'refresh':
|
||||||
removeOverlays();
|
removeOverlays();
|
||||||
populateUserList();
|
populateUserList();
|
||||||
|
UserActivityLogger.palAction("refresh");
|
||||||
break;
|
break;
|
||||||
case 'updateGain':
|
case 'updateGain':
|
||||||
data = message.params;
|
data = message.params;
|
||||||
Users.setAvatarGain(data['sessionId'], data['gain']);
|
Users.setAvatarGain(data['sessionId'], data['gain']);
|
||||||
|
UserActivityLogger.palAction("avatar_gain_changed", data['sessionId']);
|
||||||
break;
|
break;
|
||||||
case 'displayNameUpdate':
|
case 'displayNameUpdate':
|
||||||
if (MyAvatar.displayName != message.params) {
|
if (MyAvatar.displayName != message.params) {
|
||||||
MyAvatar.displayName = message.params;
|
MyAvatar.displayName = message.params;
|
||||||
|
UserActivityLogger.palAction("display_name_change");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -551,7 +555,10 @@ var button = toolBar.addButton({
|
||||||
buttonState: 1,
|
buttonState: 1,
|
||||||
alpha: 0.9
|
alpha: 0.9
|
||||||
});
|
});
|
||||||
|
|
||||||
var isWired = false;
|
var isWired = false;
|
||||||
|
var palOpenedAt;
|
||||||
|
|
||||||
function off() {
|
function off() {
|
||||||
if (isWired) { // It is not ok to disconnect these twice, hence guard.
|
if (isWired) { // It is not ok to disconnect these twice, hence guard.
|
||||||
Script.update.disconnect(updateOverlays);
|
Script.update.disconnect(updateOverlays);
|
||||||
|
@ -563,6 +570,11 @@ function off() {
|
||||||
triggerPressMapping.disable(); // see above
|
triggerPressMapping.disable(); // see above
|
||||||
removeOverlays();
|
removeOverlays();
|
||||||
Users.requestsDomainListData = false;
|
Users.requestsDomainListData = false;
|
||||||
|
if (palOpenedAt) {
|
||||||
|
var duration = new Date().getTime() - palOpenedAt;
|
||||||
|
UserActivityLogger.palOpened(duration / 1000.0);
|
||||||
|
palOpenedAt = 0; // just a falsy number is good enough.
|
||||||
|
}
|
||||||
if (audioInterval) {
|
if (audioInterval) {
|
||||||
Script.clearInterval(audioInterval);
|
Script.clearInterval(audioInterval);
|
||||||
}
|
}
|
||||||
|
@ -579,6 +591,7 @@ function onClicked() {
|
||||||
triggerMapping.enable();
|
triggerMapping.enable();
|
||||||
triggerPressMapping.enable();
|
triggerPressMapping.enable();
|
||||||
createAudioInterval();
|
createAudioInterval();
|
||||||
|
palOpenedAt = new Date().getTime();
|
||||||
} else {
|
} else {
|
||||||
off();
|
off();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue