File size: 754 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import './config';
import { recordTracksEvent } from '@automattic/calypso-analytics';
import './help-center.scss';
function initHelpCenterTracking() {
const button = document.getElementById( 'wp-admin-bar-help-center' );
if ( button && ! button.dataset.trackingInitialized ) {
button.addEventListener( 'click', () => {
recordTracksEvent( 'calypso_inlinehelp_show', {
force_site_id: true,
location: 'help-center',
section: 'wp-admin',
jetpack_disconnected_site: true,
} );
} );
// Prevent multiple initializations
button.dataset.trackingInitialized = 'true';
}
}
if ( document.readyState === 'loading' ) {
document.addEventListener( 'DOMContentLoaded', initHelpCenterTracking );
} else {
initHelpCenterTracking();
}
|