HEX
Server: Apache
System: Linux server 5.4.0-56-generic #62-Ubuntu SMP Mon Nov 23 19:20:19 UTC 2020 x86_64
User: losadagest (10000)
PHP: 7.4.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/aceitunaslosada.com/web/wp-content/plugins/wp-smushit/_src/js/mixpanel.js
/* global wp_smush_mixpanel */

import mixpanel from "mixpanel-browser";

export default class MixPanel {
	constructor() {
		this.mixpanelInstance = mixpanel.init(wp_smush_mixpanel.token, {
			opt_out_tracking_by_default: !wp_smush_mixpanel.opt_in,
			loaded: (mixpanel) => {
				mixpanel.identify(wp_smush_mixpanel.unique_id);
				mixpanel.register(wp_smush_mixpanel.super_properties);
			}
		}, 'smush');
	}

	track(event, properties = {}) {
		this.mixpanelInstance.track(event, properties);
	}

	trackBulkSmushCompleted(totalSavingsSize, totalImageCount, optimizationPercentage, savingsPercentage) {
		this.track('Bulk Smush Completed', {
			'Total Savings': totalSavingsSize,
			'Total Images': totalImageCount,
			'Media Optimization Percentage': optimizationPercentage,
			'Percentage of Savings': savingsPercentage
		});
	}

	trackBulkSmushCancel() {
		this.track('Bulk Smush Cancelled');
	}
}