Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat: Adds user props to analytics for iframe and external api.

damencho430125a8bd76
diff --git a/react/features/analytics/functions.js b/react/features/analytics/functions.js
index b24c674723..65f9bfc18b 100644
--- a/react/features/analytics/functions.js
+++ b/react/features/analytics/functions.js
@@ -1,5 +1,6 @@
// @flow
+import { API_ID } from '../../../modules/API';
import {
checkChromeExtensionsInstalled,
isMobileBrowser
@@ -155,6 +156,12 @@ export function initAnalytics({ getState }: { getState: Function }, handlers: Ar
// Report if user is using websocket
permanentProperties.websocket = navigator.product !== 'ReactNative' && typeof config.websocket === 'string';
+ // permanentProperties is external api
+ permanentProperties.externalApi = typeof API_ID === 'number';
+
+ // Report if we are loaded in iframe
+ permanentProperties.inIframe = _inIframe();
+
// Optionally, include local deployment information based on the
// contents of window.config.deploymentInfo.
if (deploymentInfo) {
@@ -184,6 +191,24 @@ export function initAnalytics({ getState }: { getState: Function }, handlers: Ar
}
}
+/**
+ * Checks whether we are loaded in iframe.
+ *
+ * @returns {boolean} Returns {@code true} if loaded in iframe.
+ * @private
+ */
+function _inIframe() {
+ if (navigator.product === 'ReactNative') {
+ return false;
+ }
+
+ try {
+ return window.self !== window.top;
+ } catch (e) {
+ return true;
+ }
+}
+
/**
* Tries to load the scripts for the analytics handlers and creates them.
*