Skip to content
Snippets Groups Projects
Commit cca246c2 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

support for matomo added

parent ed740e71
No related branches found
No related tags found
1 merge request!264Resolve "add support for matomo"
minerva-front (19.0.0~alpha.0) stable; urgency=medium
* Feature: support for matomo (#289)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 19 Sep 2024 13:00:00 +0200
minerva-front (18.0.0~beta.2) stable; urgency=medium
* Feature: minerva frontend - first version
* Bugfix: when opening overlay provide loading info (#285)
......
......@@ -5,6 +5,7 @@ export const NEUTRAL_COLOR_VAL_NAME_ID = 'NEUTRAL_COLOR_VAL';
export const OVERLAY_OPACITY_NAME_ID = 'OVERLAY_OPACITY';
export const SEARCH_DISTANCE_NAME_ID = 'SEARCH_DISTANCE';
export const REQUEST_ACCOUNT_EMAIL = 'REQUEST_ACCOUNT_EMAIL';
export const MATOMO_URL = 'MATOMO_URL';
export const LEGEND_FILE_NAMES_IDS = [
'LEGEND_FILE_1',
......
import { PROJECT_ID } from '@/constants';
import { openOverlaysDrawer, openSearchDrawerWithSelectedTab } from '@/redux/drawer/drawer.slice';
import { AppDispatch } from '@/redux/store';
import { AppDispatch, store } from '@/redux/store';
import { QueryData } from '@/types/query';
import { getDefaultSearchTab } from '@/components/FunctionalArea/TopBar/SearchBar/SearchBar.utils';
import { PluginsManager } from '@/services/pluginsManager';
......@@ -16,6 +16,7 @@ import { openSelectProjectModal } from '@/redux/modal/modal.slice';
import { getProjects } from '@/redux/projects/projects.thunks';
import { getSubmapConnectionsBioEntity } from '@/redux/bioEntity/thunks/getSubmapConnectionsBioEntity';
import { getShapes } from '@/redux/shapes/shapes.thunks';
import { MATOMO_URL } from '@/redux/configuration/configuration.constants';
import { getAllBackgroundsByProjectId } from '../backgrounds/backgrounds.thunks';
import { getConfiguration, getConfigurationOptions } from '../configuration/configuration.thunks';
import {
......@@ -62,6 +63,39 @@ export const fetchInitialAppData = createAsyncThunk<
dispatch(getShapes()),
]);
try {
const configuration = store.getState().configuration.main.data;
if (configuration) {
const options = configuration.options.filter(option => option.type === MATOMO_URL);
let url = '';
if (options.length > ZERO) {
url = options[ZERO].value ? options[ZERO].value : '';
}
if (!url.startsWith('http')) {
url = '';
}
if (url !== '') {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
// eslint-disable-next-line no-underscore-dangle,no-multi-assign
const _mtm = (window._mtm = window._mtm || []);
_mtm.push({ 'mtm.startTime': new Date().getTime(), event: 'mtm.Start' });
const d = document;
const g = d.createElement('script');
const s = d.getElementsByTagName('script')[ZERO];
g.async = true;
g.src = url;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
s.parentNode.insertBefore(g, s);
}
}
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);
}
if (queryData.pluginsId) {
await dispatch(
getInitPlugins({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment