chore: update events

This commit is contained in:
David Ralph
2021-06-21 23:03:47 +01:00
parent 7990286e9a
commit d7784e7414
24 changed files with 44 additions and 35 deletions

View File

@@ -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
};

View File

@@ -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() {

View File

@@ -1,5 +1,5 @@
export default function Lightbox(props) {
window.analytics.postEvent('modalUpdate', 'Lightbox used');
window.analytics.postEvent('modal', 'Opened lightbox');
return (
<>

View File

@@ -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');
}
}

View File

@@ -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 (

View File

@@ -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 (

View File

@@ -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)) {

View File

@@ -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,

View File

@@ -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)) {

View File

@@ -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();
}

View File

@@ -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({

View File

@@ -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)) {

View File

@@ -28,6 +28,7 @@ export default class AdvancedSettings extends React.PureComponent {
});
toast(window.language.toasts.imported);
window.analytics.postEvent('tab', 'Settings imported');
}
render() {

View File

@@ -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');
}

View File

@@ -103,6 +103,8 @@ export default class ColourSettings extends React.PureComponent {
};
return newState;
});
window.analytics.postEvent('setting', 'Changed backgroundtype from colour to gradient');
}
currentGradientSettings = () => {

View File

@@ -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
});

View File

@@ -19,7 +19,7 @@ export default class Favourite extends React.PureComponent {
this.setState({
favourited: <StarIcon2 onClick={this.favourite} className='topicons' />
});
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: <StarIcon onClick={this.favourite} className='topicons' />
});
window.analytics.postEvent('featureUpdate', 'Feature background unfavourite used');
window.analytics.postEvent('feature', 'Background unfavourite');
}
}

View File

@@ -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');
}
}

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -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() {

View File

@@ -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;
}