addded openreplay to thetool
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
</style>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $openreplayUserType = 'internal'; include(__DIR__ . "/../default/includes/openreplay.php"); ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?php
|
||||
// Prepare OpenReplay user data
|
||||
$openreplayUserId = '';
|
||||
if (class_exists('mfUser') && class_exists('mfLoginController') && mfLoginController::isLoggedIn()) {
|
||||
$user = mfUser::singleton();
|
||||
if ($user && $user->id) {
|
||||
$openreplayUserId = (string) $user->id;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
@@ -32,6 +40,34 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- OpenReplay Session Recording -->
|
||||
<script>
|
||||
var initOpts = {
|
||||
projectKey: "96MdXVcId8Ph3eOirMWj",
|
||||
ingestPoint: "https://openreplay.xinon.at/ingest",
|
||||
defaultInputMode: 2,
|
||||
obscureTextNumbers: false,
|
||||
obscureTextEmails: true,
|
||||
};
|
||||
var startOpts = { userID: <?= json_encode($openreplayUserId) ?> };
|
||||
(function(A,s,a,y,e,r){
|
||||
r=window.OpenReplay=[e,r,y,[s-1, e]];
|
||||
s=document.createElement('script');s.src=A;s.async=!a;
|
||||
document.getElementsByTagName('head')[0].appendChild(s);
|
||||
r.start=function(v){r.push([0])};
|
||||
r.stop=function(v){r.push([1])};
|
||||
r.setUserID=function(id){r.push([2,id])};
|
||||
r.setUserAnonymousID=function(id){r.push([3,id])};
|
||||
r.setMetadata=function(k,v){r.push([4,k,v])};
|
||||
r.event=function(k,p,i){r.push([5,k,p,i])};
|
||||
r.issue=function(k,p){r.push([6,k,p])};
|
||||
r.isActive=function(){return false};
|
||||
r.getSessionToken=function(){};
|
||||
})("//static.openreplay.com/17.0.0/openreplay.js",1,0,initOpts,startOpts);
|
||||
window.OpenReplay.setMetadata('userType', 'internal');
|
||||
window.OpenReplay.setMetadata('app', 'warehouse-stocktake-pwa');
|
||||
</script>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
overscroll-behavior: none;
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
<?php
|
||||
// Prepare OpenReplay user data for external company users
|
||||
$openreplayUserId = '';
|
||||
$openreplayCompanyId = $JSGlobals['COMPANY_ID'] ?? '';
|
||||
if (class_exists('mfUser') && class_exists('mfLoginController') && mfLoginController::isLoggedIn()) {
|
||||
$user = mfUser::singleton();
|
||||
if ($user && $user->id) {
|
||||
$openreplayUserId = 'company_' . $user->id;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
@@ -34,6 +43,34 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- OpenReplay Session Recording -->
|
||||
<script>
|
||||
var initOpts = {
|
||||
projectKey: "96MdXVcId8Ph3eOirMWj",
|
||||
ingestPoint: "https://openreplay.xinon.at/ingest",
|
||||
defaultInputMode: 2,
|
||||
obscureTextNumbers: false,
|
||||
obscureTextEmails: true,
|
||||
};
|
||||
var startOpts = { userID: <?= json_encode($openreplayUserId) ?> };
|
||||
(function(A,s,a,y,e,r){
|
||||
r=window.OpenReplay=[e,r,y,[s-1, e]];
|
||||
s=document.createElement('script');s.src=A;s.async=!a;
|
||||
document.getElementsByTagName('head')[0].appendChild(s);
|
||||
r.start=function(v){r.push([0])};
|
||||
r.stop=function(v){r.push([1])};
|
||||
r.setUserID=function(id){r.push([2,id])};
|
||||
r.setUserAnonymousID=function(id){r.push([3,id])};
|
||||
r.setMetadata=function(k,v){r.push([4,k,v])};
|
||||
r.event=function(k,p,i){r.push([5,k,p,i])};
|
||||
r.issue=function(k,p){r.push([6,k,p])};
|
||||
r.isActive=function(){return false};
|
||||
r.getSessionToken=function(){};
|
||||
})("//static.openreplay.com/17.0.0/openreplay.js",1,0,initOpts,startOpts);
|
||||
window.OpenReplay.setMetadata('userType', 'external');
|
||||
window.OpenReplay.setMetadata('companyId', <?= json_encode($openreplayCompanyId) ?>);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
/* Prevents the rubber-band scroll effect on iOS and pull-to-refresh on Android */
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
</style>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $openreplayUserType = 'internal'; include(__DIR__ . "/includes/openreplay.php"); ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
79
Layout/default/includes/openreplay.php
Normal file
79
Layout/default/includes/openreplay.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenReplay Session Recording Integration
|
||||
* Include this file in header templates to enable session recording.
|
||||
*
|
||||
* Usage: <?php include(__DIR__ . "/includes/openreplay.php"); ?>
|
||||
*
|
||||
* Variables that can be set before including:
|
||||
* - $openreplayUserType: 'internal' (default) or 'external'
|
||||
* - $openreplayDisabled: set to true to disable tracking
|
||||
*/
|
||||
|
||||
if (!empty($openreplayDisabled)) return;
|
||||
|
||||
$openreplayUserId = '';
|
||||
$openreplayUserName = '';
|
||||
$openreplayUserType = $openreplayUserType ?? 'internal';
|
||||
$openreplayMetadata = [];
|
||||
|
||||
// Get user info for internal users
|
||||
if (class_exists('mfUser') && class_exists('mfLoginController') && mfLoginController::isLoggedIn()) {
|
||||
$user = mfUser::singleton();
|
||||
if ($user && $user->id) {
|
||||
$openreplayUserId = (string) $user->id;
|
||||
$openreplayUserName = $user->username ?? '';
|
||||
$openreplayMetadata['userType'] = $openreplayUserType;
|
||||
$openreplayMetadata['username'] = $openreplayUserName;
|
||||
}
|
||||
}
|
||||
|
||||
// Allow override from JSGlobals (for PWA contexts)
|
||||
if (isset($JSGlobals['OPENREPLAY_USER_ID'])) {
|
||||
$openreplayUserId = (string) $JSGlobals['OPENREPLAY_USER_ID'];
|
||||
}
|
||||
if (isset($JSGlobals['OPENREPLAY_USER_TYPE'])) {
|
||||
$openreplayUserType = $JSGlobals['OPENREPLAY_USER_TYPE'];
|
||||
$openreplayMetadata['userType'] = $openreplayUserType;
|
||||
}
|
||||
if (isset($JSGlobals['OPENREPLAY_COMPANY_ID'])) {
|
||||
$openreplayMetadata['companyId'] = $JSGlobals['OPENREPLAY_COMPANY_ID'];
|
||||
}
|
||||
|
||||
// Disable on dev environment if needed
|
||||
$openreplayEnabled = true;
|
||||
if (defined('MFAPPNAME') && MFAPPNAME === 'devthetool') {
|
||||
// Optionally disable on dev - comment out to enable on dev too
|
||||
// $openreplayEnabled = false;
|
||||
}
|
||||
|
||||
if ($openreplayEnabled):
|
||||
?>
|
||||
<script>
|
||||
var initOpts = {
|
||||
projectKey: "96MdXVcId8Ph3eOirMWj",
|
||||
ingestPoint: "https://openreplay.xinon.at/ingest",
|
||||
defaultInputMode: 2,
|
||||
obscureTextNumbers: false,
|
||||
obscureTextEmails: true,
|
||||
};
|
||||
var startOpts = { userID: <?= json_encode($openreplayUserId) ?> };
|
||||
(function(A,s,a,y,e,r){
|
||||
r=window.OpenReplay=[e,r,y,[s-1, e]];
|
||||
s=document.createElement('script');s.src=A;s.async=!a;
|
||||
document.getElementsByTagName('head')[0].appendChild(s);
|
||||
r.start=function(v){r.push([0])};
|
||||
r.stop=function(v){r.push([1])};
|
||||
r.setUserID=function(id){r.push([2,id])};
|
||||
r.setUserAnonymousID=function(id){r.push([3,id])};
|
||||
r.setMetadata=function(k,v){r.push([4,k,v])};
|
||||
r.event=function(k,p,i){r.push([5,k,p,i])};
|
||||
r.issue=function(k,p){r.push([6,k,p])};
|
||||
r.isActive=function(){return false};
|
||||
r.getSessionToken=function(){};
|
||||
})("//static.openreplay.com/17.0.0/openreplay.js",1,0,initOpts,startOpts);
|
||||
<?php foreach ($openreplayMetadata as $key => $value): ?>
|
||||
window.OpenReplay.setMetadata(<?= json_encode($key) ?>, <?= json_encode($value) ?>);
|
||||
<?php endforeach; ?>
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
@@ -69,6 +69,8 @@
|
||||
|
||||
<?php endif; ?>
|
||||
</style>
|
||||
|
||||
<?php $openreplayUserType = 'internal'; include(__DIR__ . "/includes/openreplay.php"); ?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user