|
@@ -1,5 +1,6 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
|
3
|
+import { API_ID } from '../../../modules/API';
|
3
|
4
|
import {
|
4
|
5
|
checkChromeExtensionsInstalled,
|
5
|
6
|
isMobileBrowser
|
|
@@ -155,6 +156,12 @@ export function initAnalytics({ getState }: { getState: Function }, handlers: Ar
|
155
|
156
|
// Report if user is using websocket
|
156
|
157
|
permanentProperties.websocket = navigator.product !== 'ReactNative' && typeof config.websocket === 'string';
|
157
|
158
|
|
|
159
|
+ // permanentProperties is external api
|
|
160
|
+ permanentProperties.externalApi = typeof API_ID === 'number';
|
|
161
|
+
|
|
162
|
+ // Report if we are loaded in iframe
|
|
163
|
+ permanentProperties.inIframe = _inIframe();
|
|
164
|
+
|
158
|
165
|
// Optionally, include local deployment information based on the
|
159
|
166
|
// contents of window.config.deploymentInfo.
|
160
|
167
|
if (deploymentInfo) {
|
|
@@ -184,6 +191,24 @@ export function initAnalytics({ getState }: { getState: Function }, handlers: Ar
|
184
|
191
|
}
|
185
|
192
|
}
|
186
|
193
|
|
|
194
|
+/**
|
|
195
|
+ * Checks whether we are loaded in iframe.
|
|
196
|
+ *
|
|
197
|
+ * @returns {boolean} Returns {@code true} if loaded in iframe.
|
|
198
|
+ * @private
|
|
199
|
+ */
|
|
200
|
+function _inIframe() {
|
|
201
|
+ if (navigator.product === 'ReactNative') {
|
|
202
|
+ return false;
|
|
203
|
+ }
|
|
204
|
+
|
|
205
|
+ try {
|
|
206
|
+ return window.self !== window.top;
|
|
207
|
+ } catch (e) {
|
|
208
|
+ return true;
|
|
209
|
+ }
|
|
210
|
+}
|
|
211
|
+
|
187
|
212
|
/**
|
188
|
213
|
* Tries to load the scripts for the analytics handlers and creates them.
|
189
|
214
|
*
|