Decides whether to use analytics after the analytics API has been given a chance to load.
This commit is contained in:
parent
41872781f9
commit
6dbbea9944
12
index.html
12
index.html
|
@ -242,17 +242,5 @@
|
||||||
<a id="feedbackButton" data-container="body" data-toggle="popover" data-placement="right" data-i18n="[data-content]feedback"><i class="fa fa-heart"></i></a>
|
<a id="feedbackButton" data-container="body" data-toggle="popover" data-placement="right" data-i18n="[data-content]feedback"><i class="fa fa-heart"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
|
||||||
if (!config.disableThirdPartyRequests) {
|
|
||||||
[
|
|
||||||
'analytics.js?v=1'
|
|
||||||
].forEach(function(extSrc) {
|
|
||||||
var extScript = document.createElement('script');
|
|
||||||
extScript.src = extSrc;
|
|
||||||
extScript.async = false;
|
|
||||||
document.head.appendChild(extScript);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
11096
libs/lib-jitsi-meet.js
11096
libs/lib-jitsi-meet.js
File diff suppressed because it is too large
Load Diff
|
@ -1,19 +1,46 @@
|
||||||
class NoopAnalytics {
|
/* global config JitsiMeetJS */
|
||||||
sendEvent () {}
|
|
||||||
|
// Load the integration of a third-party analytics API such as Google Analytics.
|
||||||
|
// Since we cannot guarantee the quality of the third-party service (e.g. their
|
||||||
|
// server may take noticeably long time to respond), it is in our best interest
|
||||||
|
// (in the sense that the intergration of the analytics API is important to us
|
||||||
|
// but not enough to allow it to prevent people from joining a conference) to
|
||||||
|
// download the API asynchronously. Additionally, Google Analytics will download
|
||||||
|
// its implementation asynchronously anyway so it makes sense to append the
|
||||||
|
// loading on our side rather than prepend it.
|
||||||
|
if (config.disableThirdPartyRequests !== true) {
|
||||||
|
JitsiMeetJS.util.ScriptUtil.loadScript(
|
||||||
|
'analytics.js?v=1',
|
||||||
|
/* async */ true,
|
||||||
|
/* prepend */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const AnalyticsImpl = window.Analytics || NoopAnalytics;
|
class NoopAnalytics {
|
||||||
|
sendEvent () {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX Since we asynchronously load the integration of the analytics API and the
|
||||||
|
// analytics API may asynchronously load its implementation (e.g. Google
|
||||||
|
// Analytics), we cannot make the decision with respect to which analytics
|
||||||
|
// implementation we will use here and we have to postpone it i.e. we will make
|
||||||
|
// a lazy decision.
|
||||||
|
|
||||||
class AnalyticsAdapter {
|
class AnalyticsAdapter {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.analytics = new AnalyticsImpl();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
sendEvent (...args) {
|
sendEvent (...args) {
|
||||||
try {
|
var a = this.analytics;
|
||||||
this.analytics.sendEvent(...args);
|
|
||||||
} catch (ignored) {}
|
if (a === null || typeof a === 'undefined') {
|
||||||
}
|
var AnalyticsImpl = window.Analytics || NoopAnalytics;
|
||||||
|
|
||||||
|
this.analytics = a = new AnalyticsImpl();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
a.sendEvent(...args);
|
||||||
|
} catch (ignored) {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new AnalyticsAdapter();
|
export default new AnalyticsAdapter();
|
||||||
|
|
Loading…
Reference in New Issue