HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/html/ielts-store/wp-content/plugins/automatewoo/admin/assets/js/tracks.js
/**
 * This module is a reduced clone of @woocommerce/tracks, for jQuery/legacy code-base.
 * It has no side-effect, only exports a suggar function on top of `window.wcTracks.recordEvent`.
 */
( function() {
	/**
	 * Console.log args in a way that mimics debug's behavior.
	 * Log is shown only if localStorage contains the 'debug' item with a pattern that matches 'wc-admin:tracks'.
	 * Paint that namespace in #FF33CC - the hardcoded color that should match the one generated by debug.
	 * 
	 * @param {...*} arguments to be logged. 
	 */
	function tracksDebug( ...args ) {
		const debugNamespace = 'wc-admin:tracks';
		// Hard-coded color value of debug.selectColor( 'wc-admin:tracks' )
		// https://github.com/visionmedia/debug/blob/3f56313c1e4a0d59c1054fb9b10026b6903bfba7/src/common.js#L41
		const debugColor = "#FF33CC";

		// Mimic debug's enable/disable behavior.
		let isEnabled = localStorage.getItem( 'debug' )
		isEnabled = isEnabled && ( new RegExp( '^' + isEnabled.replace( /\*/g, '.*?' ) + '$' ) ).test( debugNamespace );
	
		if( isEnabled ) {
			// We do not provide the diff time as we cannot access the same counter as debug, 
			// having a separate one would be even more confusing.
			console.log( `%c${ debugNamespace }`, `color: ${ debugColor };`, ...args );
		}
	}
	/**
	 * Record an event to Tracks.
	 * This is a clone of @woocommerce/tracks.recordEvent for legacy jQuery files.
	 *
	 * @see @woocommerce/tracks.recordEvent
	 * 
	 * @param {string} eventName The name of the event to record, don't include the wcadmin_ prefix
	 * @param {Object} eventProperties event properties to include in the event
	 */
	function recordEvent( eventName, eventProperties ) {
		// copied from ../src/settings.js
		const TRACKS_PREFIX = 'aw_';
		eventName = TRACKS_PREFIX + eventName;

		tracksDebug( `recordevent wcadmin_${ eventName } `, eventProperties, {
			_tqk: window._tkq,
			shouldRecord: !!window._tkq && !!window.wcTracks && !!window.wcTracks.isEnabled
		} );

		if ( !window.wcTracks || typeof window.wcTracks.recordEvent !== 'function' ) {
			return false;
		}

		// 'wcadmin_' prefix is also added in the `recordEvent`.
		window.wcTracks.recordEvent( eventName, eventProperties );
    }

    // Export only recordEvent to the global namespace.
    AW.tracks = { recordEvent };
} )();