diff --git a/src/components/modals/ErrorBoundary.jsx b/src/components/modals/ErrorBoundary.jsx index aa00d85c..f888927a 100644 --- a/src/components/modals/ErrorBoundary.jsx +++ b/src/components/modals/ErrorBoundary.jsx @@ -13,7 +13,7 @@ export default class ErrorBoundary extends React.PureComponent { static getDerivedStateFromError(error) { console.log(error); - window.analytics.postEvent('modalUpdate', 'Error occurred'); + window.analytics.postEvent('modal', 'Error occurred'); return { error: true }; diff --git a/src/components/modals/Modals.jsx b/src/components/modals/Modals.jsx index 00f76f99..439bc207 100644 --- a/src/components/modals/Modals.jsx +++ b/src/components/modals/Modals.jsx @@ -27,7 +27,7 @@ export default class Modals extends React.PureComponent { this.setState({ welcomeModal: true }); - window.analytics.postEvent('modalUpdate', 'Opened welcome modal'); + window.analytics.postEvent('modal', 'Opened welcome'); } // hide refresh reminder once the user has refreshed the page @@ -39,14 +39,16 @@ export default class Modals extends React.PureComponent { this.setState({ welcomeModal: false }); - window.analytics.postEvent('modalUpdate', 'Closed welcome modal'); } toggleModal(type, action) { this.setState({ [type]: action }); - window.analytics.postEvent('modalUpdate', `${(action === false) ? 'Closed' : 'Opened'} ${type.replace('Modal', '')} modal`); + + if (action !== false) { + window.analytics.postEvent('modal', `Opened ${type.replace('Modal', '')}`); + } } render() { diff --git a/src/components/modals/main/marketplace/Lightbox.jsx b/src/components/modals/main/marketplace/Lightbox.jsx index 3baee097..d430bc6f 100644 --- a/src/components/modals/main/marketplace/Lightbox.jsx +++ b/src/components/modals/main/marketplace/Lightbox.jsx @@ -1,5 +1,5 @@ export default function Lightbox(props) { - window.analytics.postEvent('modalUpdate', 'Lightbox used'); + window.analytics.postEvent('modal', 'Opened lightbox'); return ( <> diff --git a/src/components/modals/main/marketplace/sections/Added.jsx b/src/components/modals/main/marketplace/sections/Added.jsx index fe8501ea..a85a73bf 100644 --- a/src/components/modals/main/marketplace/sections/Added.jsx +++ b/src/components/modals/main/marketplace/sections/Added.jsx @@ -42,7 +42,7 @@ export default class Added extends React.PureComponent { }, button: this.buttons.uninstall }); - window.analytics.postEvent('marketplaceUpdate', `Item viewed`); + window.analytics.postEvent('marketplace', 'Item viewed'); } else { this.setState({ item: {} @@ -60,7 +60,7 @@ export default class Added extends React.PureComponent { installed: JSON.parse(localStorage.getItem('installed')) }); - window.analytics.postEvent('marketplaceUpdate', 'Uninstall used'); + window.analytics.postEvent('marketplace', 'Uninstall'); } sortAddons(value, sendEvent) { @@ -87,7 +87,7 @@ export default class Added extends React.PureComponent { }); if (sendEvent) { - window.analytics.postEvent('marketplaceUpdate', 'Sort used'); + window.analytics.postEvent('marketplace', 'Sort'); } } diff --git a/src/components/modals/main/marketplace/sections/Marketplace.jsx b/src/components/modals/main/marketplace/sections/Marketplace.jsx index 17268d59..699fe3b7 100644 --- a/src/components/modals/main/marketplace/sections/Marketplace.jsx +++ b/src/components/modals/main/marketplace/sections/Marketplace.jsx @@ -68,7 +68,7 @@ export default class Marketplace extends React.PureComponent { button: button }); - window.analytics.postEvent('marketplaceItemUpdate', `${this.state.item.display_name} viewed`); + window.analytics.postEvent('marketplace-item', `${this.state.item.display_name} viewed`); } else { this.setState({ item: {} @@ -106,8 +106,8 @@ export default class Marketplace extends React.PureComponent { button: (type === 'install') ? this.buttons.uninstall : this.buttons.install }); - window.analytics.postEvent('marketplaceItemUpdate', `${this.state.item.display_name} ${(type === 'install' ? 'installed': 'uninstalled')}`); - window.analytics.postEvent('marketplaceUpdate', `${(type === 'install' ? 'Install': 'Uninstall')} used`); + window.analytics.postEvent('marketplace-item', `${this.state.item.display_name} ${(type === 'install' ? 'installed': 'uninstalled')}`); + window.analytics.postEvent('marketplace', (type === 'install' ? 'Install': 'Uninstall')); } sortMarketplace(value, sendEvent) { @@ -134,7 +134,7 @@ export default class Marketplace extends React.PureComponent { }); if (sendEvent) { - window.analytics.postEvent('marketplaceUpdate', 'Sort used'); + window.analytics.postEvent('marketplace', 'Sort'); } } @@ -164,7 +164,7 @@ export default class Marketplace extends React.PureComponent { const featured = () => { const openFeatured = () => { - window.analytics.postEvent('marketplaceUpdate', 'Featured click used'); + window.analytics.postEvent('marketplace', 'Featured clicked'); window.open(this.state.featured.buttonLink); } return ( diff --git a/src/components/modals/main/marketplace/sections/Sideload.jsx b/src/components/modals/main/marketplace/sections/Sideload.jsx index 14b7eb17..eb6d8904 100644 --- a/src/components/modals/main/marketplace/sections/Sideload.jsx +++ b/src/components/modals/main/marketplace/sections/Sideload.jsx @@ -10,7 +10,7 @@ export default function Sideload() { const install = (input) => { MarketplaceFunctions.install(input.type, input); toast(window.language.toasts.installed); - window.analytics.postEvent('marketplaceUpdate', 'Sideload used'); + window.analytics.postEvent('marketplace', 'Sideload'); }; return ( diff --git a/src/components/modals/main/settings/Checkbox.jsx b/src/components/modals/main/settings/Checkbox.jsx index 1315f76f..037a9e5b 100644 --- a/src/components/modals/main/settings/Checkbox.jsx +++ b/src/components/modals/main/settings/Checkbox.jsx @@ -21,7 +21,7 @@ export default class Checkbox extends React.PureComponent { checked: (this.state.checked === true) ? false : true }); - window.analytics.postEvent('settingUpdate', `${(this.state.checked === true) ? 'Enabled' : 'Disabled'} setting ${this.props.name}`); + window.analytics.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`); if (this.props.element) { if (!document.querySelector(this.props.element)) { diff --git a/src/components/modals/main/settings/Dropdown.jsx b/src/components/modals/main/settings/Dropdown.jsx index d4146a7b..7409de91 100644 --- a/src/components/modals/main/settings/Dropdown.jsx +++ b/src/components/modals/main/settings/Dropdown.jsx @@ -22,7 +22,7 @@ export default class Dropdown extends React.PureComponent { return; } - window.analytics.postEvent('settingUpdate', `Changed setting ${this.props.name} from ${this.state.value} to ${value}`); + window.analytics.postEvent('setting', `${this.props.name} from ${this.state.value} to ${value}`); this.setState({ value: value, diff --git a/src/components/modals/main/settings/Radio.jsx b/src/components/modals/main/settings/Radio.jsx index 772221dc..02ff4d6b 100644 --- a/src/components/modals/main/settings/Radio.jsx +++ b/src/components/modals/main/settings/Radio.jsx @@ -29,7 +29,7 @@ export default class Radio extends React.PureComponent { value: value }); - window.analytics.postEvent('settingUpdate', `Changed setting ${this.props.name} from ${this.state.value} to ${value}`); + window.analytics.postEvent('setting', `${this.props.name} from ${this.state.value} to ${value}`); if (this.props.element) { if (!document.querySelector(this.props.element)) { diff --git a/src/components/modals/main/settings/ResetModal.jsx b/src/components/modals/main/settings/ResetModal.jsx index 6ef66cea..a247d3ff 100644 --- a/src/components/modals/main/settings/ResetModal.jsx +++ b/src/components/modals/main/settings/ResetModal.jsx @@ -4,6 +4,7 @@ export default function ResetModal(props) { const language = window.language.modals.main.settings.sections.advanced.reset_modal; const reset = () => { + window.analytics.postEvent('setting', 'Reset'); SettingsFunctions.setDefaultSettings('reset'); window.location.reload(); } diff --git a/src/components/modals/main/settings/Slider.jsx b/src/components/modals/main/settings/Slider.jsx index 188e0105..b6726477 100644 --- a/src/components/modals/main/settings/Slider.jsx +++ b/src/components/modals/main/settings/Slider.jsx @@ -19,8 +19,6 @@ export default class Slider extends React.PureComponent { handleChange = (e, text) => { let { value } = e.target; - window.analytics.postEvent('settingUpdate', `Changed setting ${this.props.name} from ${this.state.value} to ${value}`); - if (text) { if (value === '') { return this.setState({ diff --git a/src/components/modals/main/settings/Switch.jsx b/src/components/modals/main/settings/Switch.jsx index 96503c41..7b45a6af 100644 --- a/src/components/modals/main/settings/Switch.jsx +++ b/src/components/modals/main/settings/Switch.jsx @@ -21,7 +21,7 @@ export default class Switch extends React.PureComponent { checked: (this.state.checked === true) ? false : true }); - window.analytics.postEvent('settingUpdate', `${(this.state.checked === true) ? 'Enabled' : 'Disabled'} setting ${this.props.name}`); + window.analytics.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`); if (this.props.element) { if (!document.querySelector(this.props.element)) { diff --git a/src/components/modals/main/settings/sections/Advanced.jsx b/src/components/modals/main/settings/sections/Advanced.jsx index 6935b7b9..408f147c 100644 --- a/src/components/modals/main/settings/sections/Advanced.jsx +++ b/src/components/modals/main/settings/sections/Advanced.jsx @@ -28,6 +28,7 @@ export default class AdvancedSettings extends React.PureComponent { }); toast(window.language.toasts.imported); + window.analytics.postEvent('tab', 'Settings imported'); } render() { diff --git a/src/components/modals/main/settings/sections/Order.jsx b/src/components/modals/main/settings/sections/Order.jsx index 854a86df..35d9075f 100644 --- a/src/components/modals/main/settings/sections/Order.jsx +++ b/src/components/modals/main/settings/sections/Order.jsx @@ -83,6 +83,7 @@ export default class OrderSettings extends React.PureComponent { componentDidUpdate() { localStorage.setItem('order', JSON.stringify(this.state.items)); + window.analytics.postEvent('setting', 'Widget order'); EventBus.dispatch('refresh', 'widgets'); } diff --git a/src/components/modals/main/settings/sections/background/Colour.jsx b/src/components/modals/main/settings/sections/background/Colour.jsx index 7890aa03..2a2779c9 100644 --- a/src/components/modals/main/settings/sections/background/Colour.jsx +++ b/src/components/modals/main/settings/sections/background/Colour.jsx @@ -103,6 +103,8 @@ export default class ColourSettings extends React.PureComponent { }; return newState; }); + + window.analytics.postEvent('setting', 'Changed backgroundtype from colour to gradient'); } currentGradientSettings = () => { diff --git a/src/components/modals/main/tabs/backend/Tabs.jsx b/src/components/modals/main/tabs/backend/Tabs.jsx index f042a565..bcc9c368 100644 --- a/src/components/modals/main/tabs/backend/Tabs.jsx +++ b/src/components/modals/main/tabs/backend/Tabs.jsx @@ -13,7 +13,10 @@ export default class Tabs extends React.PureComponent { } onClick = (tab) => { - window.analytics.postEvent('tabUpdate', `Changed tab from ${this.state.currentTab} to ${tab}`); + if (tab !== this.state.currentTab) { + window.analytics.postEvent('tab', `Changed ${this.state.currentTab} to ${tab}`); + } + this.setState({ currentTab: tab }); diff --git a/src/components/widgets/background/Favourite.jsx b/src/components/widgets/background/Favourite.jsx index f61cafce..4282acb0 100644 --- a/src/components/widgets/background/Favourite.jsx +++ b/src/components/widgets/background/Favourite.jsx @@ -19,7 +19,7 @@ export default class Favourite extends React.PureComponent { this.setState({ favourited: }); - window.analytics.postEvent('featureUpdate', 'Feature background favourite used'); + window.analytics.postEvent('feature', 'Background favourite'); } else { const url = document.getElementById('backgroundImage').style.backgroundImage.replace('url("', '').replace('")', ''); @@ -38,7 +38,7 @@ export default class Favourite extends React.PureComponent { this.setState({ favourited: }); - window.analytics.postEvent('featureUpdate', 'Feature background unfavourite used'); + window.analytics.postEvent('feature', 'Background unfavourite'); } } diff --git a/src/components/widgets/background/Maximise.jsx b/src/components/widgets/background/Maximise.jsx index b5ff9855..bdf28277 100644 --- a/src/components/widgets/background/Maximise.jsx +++ b/src/components/widgets/background/Maximise.jsx @@ -44,14 +44,14 @@ export default class Maximise extends React.PureComponent { }); this.setAttribute(0, 100); - window.analytics.postEvent('featureUpdate', 'Feature background maximise used'); + window.analytics.postEvent('feature', 'Background maximise'); } else { this.setState({ hidden: false }); this.setAttribute(localStorage.getItem('blur'), localStorage.getItem('brightness'), true); - window.analytics.postEvent('featureUpdate', 'Feature background unmaximise used'); + window.analytics.postEvent('feature', 'Background unmaximise'); } } diff --git a/src/components/widgets/background/PhotoInformation.jsx b/src/components/widgets/background/PhotoInformation.jsx index fb4d091f..5c061b24 100644 --- a/src/components/widgets/background/PhotoInformation.jsx +++ b/src/components/widgets/background/PhotoInformation.jsx @@ -18,7 +18,7 @@ const downloadImage = async (info) => { document.body.appendChild(link); link.click(); document.body.removeChild(link); - window.analytics.postEvent('featureUpdate', 'Feature background download used'); + window.analytics.postEvent('feature', 'Background download'); }; export default function PhotoInformation(props) { diff --git a/src/components/widgets/navbar/Notes.jsx b/src/components/widgets/navbar/Notes.jsx index 31a9d5eb..46a891d9 100644 --- a/src/components/widgets/navbar/Notes.jsx +++ b/src/components/widgets/navbar/Notes.jsx @@ -25,7 +25,7 @@ export default class Notes extends React.PureComponent { }; pin() { - window.analytics.postEvent('featureUpdate', 'Feature notes pin used'); + window.analytics.postEvent('feature', 'Notes pin'); document.getElementById('noteContainer').classList.toggle('visibilityshow'); if (localStorage.getItem('notesPinned') === 'true') { @@ -36,7 +36,7 @@ export default class Notes extends React.PureComponent { } copy() { - window.analytics.postEvent('featureUpdate', 'Feature notes copy used'); + window.analytics.postEvent('feature', 'Notes copied'); // this.state.notes doesnt work for some reason navigator.clipboard.writeText(localStorage.getItem('notes')); toast(window.language.toasts.notes); diff --git a/src/components/widgets/quicklinks/QuickLinks.jsx b/src/components/widgets/quicklinks/QuickLinks.jsx index 6f60ed27..02f8791c 100644 --- a/src/components/widgets/quicklinks/QuickLinks.jsx +++ b/src/components/widgets/quicklinks/QuickLinks.jsx @@ -32,7 +32,7 @@ export default class QuickLinks extends React.PureComponent { items: data }); - window.analytics.postEvent('featureUpdate', 'Feature delete quicklink used'); + window.analytics.postEvent('feature', 'Quicklink delete'); } addLink = () => { @@ -75,7 +75,7 @@ export default class QuickLinks extends React.PureComponent { url: '' }); - window.analytics.postEvent('featureUpdate', 'Feature add quicklink used'); + window.analytics.postEvent('feature', 'Quicklink add'); this.toggleAdd(); } diff --git a/src/components/widgets/quote/Quote.jsx b/src/components/widgets/quote/Quote.jsx index a39362e4..7f08f34c 100644 --- a/src/components/widgets/quote/Quote.jsx +++ b/src/components/widgets/quote/Quote.jsx @@ -150,13 +150,13 @@ export default class Quote extends React.PureComponent { } copyQuote = () => { - window.analytics.postEvent('featureUpdate', 'Feature quote copy used'); + window.analytics.postEvent('feature', 'Quote copied'); navigator.clipboard.writeText(`${this.state.quote} - ${this.state.author}`); toast(window.language.toasts.quote); } tweetQuote = () => { - window.analytics.postEvent('featureUpdate', 'Feature quote tweet used'); + window.analytics.postEvent('feature', 'Quote tweet'); window.open(`https://twitter.com/intent/tweet?text=${this.state.quote} - ${this.state.author} on @getmue`, '_blank').focus(); } @@ -173,7 +173,7 @@ export default class Quote extends React.PureComponent { }); } - window.analytics.postEvent('featureUpdate', 'Feature quote favourite used'); + window.analytics.postEvent('feature', 'Quote favourite'); } init() { diff --git a/src/components/widgets/search/Search.jsx b/src/components/widgets/search/Search.jsx index 0f67000e..c22482c6 100644 --- a/src/components/widgets/search/Search.jsx +++ b/src/components/widgets/search/Search.jsx @@ -44,7 +44,7 @@ export default class Search extends React.PureComponent { } setTimeout(() => { - window.analytics.postEvent('featureUpdate', 'Feature voice search used'); + window.analytics.postEvent('feature', 'Voice search'); window.location.href = this.state.url + `?${this.state.query}=` + searchText.value; }, 1000); }; @@ -59,7 +59,7 @@ export default class Search extends React.PureComponent { value = document.getElementById('searchtext').value || 'mue fast'; } - window.analytics.postEvent('featureUpdate', 'Feature search used'); + window.analytics.postEvent('feature', 'Search'); window.location.href = this.state.url + `?${this.state.query}=` + value; } diff --git a/src/modules/helpers/settings.js b/src/modules/helpers/settings.js index b45f064d..57e92c9c 100644 --- a/src/modules/helpers/settings.js +++ b/src/modules/helpers/settings.js @@ -27,6 +27,7 @@ export default class SettingsFunctions { settings[key] = localStorage.getItem(key); }); saveFile(settings, 'mue-settings.json'); + window.analytics.postEvent('tab', 'Settings exported'); } static setItem(key, value) {