commit
423c8d3f53
|
@ -4,16 +4,23 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function Analytics() {
|
function Analytics(options) {
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
|
if (!options.googleAnalyticsTrackingId) {
|
||||||
|
console.log(
|
||||||
|
'Failed to initialize Google Analytics handler, no tracking ID');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Google Analytics
|
* Google Analytics
|
||||||
|
* TODO: Keep this local, there's no need to add it to window.
|
||||||
*/
|
*/
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
ga('create', 'UA-319188-14', 'jit.si');
|
ga('create', options.googleAnalyticsTrackingId, 'jit.si');
|
||||||
ga('send', 'pageview');
|
ga('send', 'pageview');
|
||||||
|
|
||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
|
@ -93,6 +100,7 @@
|
||||||
// lengthy and is probably included from elsewhere.
|
// lengthy and is probably included from elsewhere.
|
||||||
for (const property in event.attributes) {
|
for (const property in event.attributes) {
|
||||||
if (property !== 'permanent_user_agent'
|
if (property !== 'permanent_user_agent'
|
||||||
|
&& property !== 'permanent_callstats_name'
|
||||||
&& event.attributes.hasOwnProperty(property)) {
|
&& event.attributes.hasOwnProperty(property)) {
|
||||||
// eslint-disable-next-line prefer-template
|
// eslint-disable-next-line prefer-template
|
||||||
label += property + '=' + event.attributes[property] + '&';
|
label += property + '=' + event.attributes[property] + '&';
|
||||||
|
@ -114,7 +122,7 @@
|
||||||
* lib-jitsi-meet.
|
* lib-jitsi-meet.
|
||||||
*/
|
*/
|
||||||
Analytics.prototype.sendEvent = function(event) {
|
Analytics.prototype.sendEvent = function(event) {
|
||||||
if (!event) {
|
if (!event || !ga) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -313,6 +313,9 @@ var config = {
|
||||||
// "https://example.com/my-custom-analytics.js"
|
// "https://example.com/my-custom-analytics.js"
|
||||||
// ],
|
// ],
|
||||||
|
|
||||||
|
// The Google Analytics Tracking ID
|
||||||
|
// googleAnalyticsTrackingId = 'your-tracking-id-here-UA-123456-1',
|
||||||
|
|
||||||
// Information about the jitsi-meet instance we are connecting to, including
|
// Information about the jitsi-meet instance we are connecting to, including
|
||||||
// the user region as seen by the server.
|
// the user region as seen by the server.
|
||||||
deploymentInfo: {
|
deploymentInfo: {
|
||||||
|
|
|
@ -43,10 +43,12 @@ export function initAnalytics({ getState }: { getState: Function }) {
|
||||||
|
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const config = state['features/base/config'];
|
const config = state['features/base/config'];
|
||||||
const { analyticsScriptUrls, deploymentInfo } = config;
|
const { analyticsScriptUrls, deploymentInfo, googleAnalyticsTrackingId }
|
||||||
|
= config;
|
||||||
const { group, server, user } = state['features/base/jwt'];
|
const { group, server, user } = state['features/base/jwt'];
|
||||||
const handlerConstructorOptions = {
|
const handlerConstructorOptions = {
|
||||||
envType: (deploymentInfo && deploymentInfo.envType) || 'dev',
|
envType: (deploymentInfo && deploymentInfo.envType) || 'dev',
|
||||||
|
googleAnalyticsTrackingId,
|
||||||
group,
|
group,
|
||||||
product: deploymentInfo && deploymentInfo.product,
|
product: deploymentInfo && deploymentInfo.product,
|
||||||
subproduct: deploymentInfo && deploymentInfo.environment,
|
subproduct: deploymentInfo && deploymentInfo.environment,
|
||||||
|
|
Loading…
Reference in New Issue