diff --git a/app/src/components/containers/initialDataContainer/initialDataContainer.jsx b/app/src/components/containers/initialDataContainer/initialDataContainer.jsx
index 905701c0bb..e524be3f7b 100644
--- a/app/src/components/containers/initialDataContainer/initialDataContainer.jsx
+++ b/app/src/components/containers/initialDataContainer/initialDataContainer.jsx
@@ -18,7 +18,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { analyticsEnabledSelector } from 'controllers/appInfo';
-import { AnalyticsWrapper } from 'components/main/analytics/AnalyticsWrapper';
+import { AnalyticsWrapper, EmptyAnalyticsWrapper } from 'components/main/analytics';
import { fetchInitialDataAction, initialDataReadySelector } from 'controllers/initialData';
@connect(
@@ -61,13 +61,9 @@ export class InitialDataContainer extends Component {
}
render() {
- const { isAnalyticsEnabled } = this.props;
- const component = isAnalyticsEnabled ? (
- {this.props.children}
- ) : (
- this.props.children
- );
+ const { isAnalyticsEnabled, isInitialDataReady, children } = this.props;
+ const Analytics = isAnalyticsEnabled ? AnalyticsWrapper : EmptyAnalyticsWrapper;
- return this.props.isInitialDataReady ? component : Loading...;
+ return isInitialDataReady ? {children} : Loading...;
}
}
diff --git a/app/src/components/main/analytics/EmptyAnalyticsWrapper.jsx b/app/src/components/main/analytics/EmptyAnalyticsWrapper.jsx
new file mode 100644
index 0000000000..42fd82f750
--- /dev/null
+++ b/app/src/components/main/analytics/EmptyAnalyticsWrapper.jsx
@@ -0,0 +1,12 @@
+import PropTypes from 'prop-types';
+import track from 'react-tracking';
+
+const AnalyticsWrapper = ({ children }) => children;
+AnalyticsWrapper.propTypes = {
+ children: PropTypes.node,
+};
+AnalyticsWrapper.defaultProps = {
+ children: null,
+};
+
+export const EmptyAnalyticsWrapper = track()(AnalyticsWrapper);
diff --git a/app/src/components/main/analytics/index.js b/app/src/components/main/analytics/index.js
index fae3c05712..610064cdd4 100644
--- a/app/src/components/main/analytics/index.js
+++ b/app/src/components/main/analytics/index.js
@@ -15,5 +15,6 @@
*/
export { AnalyticsWrapper } from './AnalyticsWrapper';
+export { EmptyAnalyticsWrapper } from './EmptyAnalyticsWrapper';
export { pageEventsMap } from './constants';
export { provideEcGA } from './utils';
diff --git a/app/src/pages/inside/dashboardItemPage/modals/widgetWizardModal/widgetWizardContent/widgetWizardContent.jsx b/app/src/pages/inside/dashboardItemPage/modals/widgetWizardModal/widgetWizardContent/widgetWizardContent.jsx
index 9356a96346..87aa69744b 100644
--- a/app/src/pages/inside/dashboardItemPage/modals/widgetWizardModal/widgetWizardContent/widgetWizardContent.jsx
+++ b/app/src/pages/inside/dashboardItemPage/modals/widgetWizardModal/widgetWizardContent/widgetWizardContent.jsx
@@ -27,6 +27,7 @@ import { showScreenLockAction, hideScreenLockAction } from 'controllers/screenLo
import { showDefaultErrorNotification } from 'controllers/notification';
import { activeProjectSelector } from 'controllers/user';
import { fetchDashboardsAction } from 'controllers/dashboard';
+import { analyticsEnabledSelector } from 'controllers/appInfo';
import { getWidgets } from 'pages/inside/dashboardItemPage/modals/common/widgets';
import { provideEcGA } from 'components/main/analytics';
import { activeDashboardIdSelector, pageSelector } from 'controllers/pages';
@@ -44,6 +45,7 @@ const cx = classNames.bind(styles);
projectId: activeProjectSelector(state),
activeDashboardId: activeDashboardIdSelector(state),
currentPage: pageSelector(state),
+ isAnalyticsEnabled: analyticsEnabledSelector(state),
}),
{
submitWidgetWizardForm: () => submit(WIDGET_WIZARD_FORM),
@@ -65,6 +67,7 @@ export class WidgetWizardContent extends Component {
showDefaultErrorNotification: PropTypes.func.isRequired,
closeModal: PropTypes.func.isRequired,
showConfirmation: PropTypes.bool.isRequired,
+ isAnalyticsEnabled: PropTypes.bool.isRequired,
onConfirm: PropTypes.func,
eventsInfo: PropTypes.object,
tracking: PropTypes.shape({
@@ -97,13 +100,19 @@ export class WidgetWizardContent extends Component {
}
onClickNextStep = () => {
- const { tracking, eventsInfo, formValues, submitWidgetWizardForm } = this.props;
+ const {
+ tracking,
+ eventsInfo,
+ formValues,
+ submitWidgetWizardForm,
+ isAnalyticsEnabled,
+ } = this.props;
tracking.trackEvent(eventsInfo.nextStep);
if (this.state.step === 1 && formValues.contentParameters.contentFields) {
tracking.trackEvent(eventsInfo.selectCriteria(formValues.contentParameters.contentFields));
}
submitWidgetWizardForm();
- if (this.state.step === 0) {
+ if (isAnalyticsEnabled && this.state.step === 0) {
provideEcGA({
name: 'addProduct',
data: {
@@ -128,6 +137,7 @@ export class WidgetWizardContent extends Component {
eventsInfo: { addWidget },
projectId,
onConfirm,
+ isAnalyticsEnabled,
} = this.props;
const { selectedDashboard, ...rest } = formData;
const data = prepareWidgetDataForSubmit(this.preprocessOutputData(rest));
@@ -146,17 +156,20 @@ export class WidgetWizardContent extends Component {
...getDefaultWidgetConfig(data.widgetType),
};
onConfirm(newWidget, this.props.closeModal, selectedDashboard);
- provideEcGA({
- name: 'addProduct',
- data: {
- id,
- name: data.widgetType,
- category: `diagram/${data.contentParameters.widgetOptions.viewMode || 'unclassified'}`,
- variant: this.props.currentPage,
- },
- action: 'add',
- additionalData: { list: selectedDashboard.id },
- });
+ if (isAnalyticsEnabled) {
+ provideEcGA({
+ name: 'addProduct',
+ data: {
+ id,
+ name: data.widgetType,
+ category: `diagram/${data.contentParameters.widgetOptions.viewMode ||
+ 'unclassified'}`,
+ variant: this.props.currentPage,
+ },
+ action: 'add',
+ additionalData: { list: selectedDashboard.id },
+ });
+ }
})
.catch((err) => {
this.props.hideScreenLockAction();
diff --git a/app/src/pages/inside/dashboardItemPage/widgetsGrid/widget/widget.jsx b/app/src/pages/inside/dashboardItemPage/widgetsGrid/widget/widget.jsx
index 0dea8dd5f2..1b9520c99c 100644
--- a/app/src/pages/inside/dashboardItemPage/widgetsGrid/widget/widget.jsx
+++ b/app/src/pages/inside/dashboardItemPage/widgetsGrid/widget/widget.jsx
@@ -27,6 +27,7 @@ import { URLS } from 'common/urls';
import { CUMULATIVE_TREND } from 'common/constants/widgetTypes';
import { activeProjectSelector } from 'controllers/user';
import { showModalAction } from 'controllers/modal';
+import { analyticsEnabledSelector } from 'controllers/appInfo';
import { SpinningPreloader } from 'components/preloaders/spinningPreloader';
import { DASHBOARD_PAGE_EVENTS } from 'components/main/analytics/events';
import { ErrorMessage } from 'components/main/errorMessage';
@@ -60,6 +61,7 @@ const SILENT_UPDATE_TIMEOUT_FULLSCREEN = 30000;
(state) => ({
activeProject: activeProjectSelector(state),
activeDashboardId: activeDashboardIdSelector(state),
+ isAnalyticsEnabled: analyticsEnabledSelector(state),
}),
{
showModalAction,
@@ -85,6 +87,7 @@ export class SimpleWidget extends Component {
}).isRequired,
dashboardOwner: PropTypes.string,
activeDashboardId: PropTypes.number.isRequired,
+ isAnalyticsEnabled: PropTypes.bool.isRequired,
};
static defaultProps = {
@@ -332,23 +335,27 @@ export class SimpleWidget extends Component {
};
showDeleteWidgetModal = () => {
- this.props.tracking.trackEvent(DASHBOARD_PAGE_EVENTS.REMOVE_WIDGET);
+ const { tracking, isAnalyticsEnabled, onDelete } = this.props;
+
+ tracking.trackEvent(DASHBOARD_PAGE_EVENTS.REMOVE_WIDGET);
const onConfirm = () => {
const { widgetId, activeDashboardId } = this.props;
const {
widget: { id, widgetType, contentParameters },
} = this.state;
- this.props.onDelete(widgetId);
- provideEcGA({
- name: 'addProduct',
- data: {
- id,
- name: widgetType,
- category: `diagram/${contentParameters.widgetOptions.viewMode || 'unclassified'}`,
- },
- action: 'remove',
- additionalData: { list: activeDashboardId },
- });
+ onDelete(widgetId);
+ if (isAnalyticsEnabled) {
+ provideEcGA({
+ name: 'addProduct',
+ data: {
+ id,
+ name: widgetType,
+ category: `diagram/${contentParameters.widgetOptions.viewMode || 'unclassified'}`,
+ },
+ action: 'remove',
+ additionalData: { list: activeDashboardId },
+ });
+ }
};
this.props.showModalAction({
id: 'deleteWidgetModal',
diff --git a/app/src/pages/inside/filtersPage/filterGrid/filterOptions/filterOptions.jsx b/app/src/pages/inside/filtersPage/filterGrid/filterOptions/filterOptions.jsx
index 22f6df0307..ab0e54de7e 100644
--- a/app/src/pages/inside/filtersPage/filterGrid/filterOptions/filterOptions.jsx
+++ b/app/src/pages/inside/filtersPage/filterGrid/filterOptions/filterOptions.jsx
@@ -122,7 +122,9 @@ export class FilterOptions extends Component {
} else if (type === OPTIONS.STATISTICS) {
optionName = this.statisticsOptions(entity);
} else {
- optionName = intl.formatMessage(messages[entity.filteringField]);
+ optionName = messages[entity.filteringField]
+ ? intl.formatMessage(messages[entity.filteringField])
+ : entity.filteringField;
}
switch (entity.condition) {
case CONDITION_GREATER_EQ: