Add property to check if wcTracks is enabled
This commit is contained in:
parent
07087c79a7
commit
3f9db6a558
|
@ -65,7 +65,12 @@ class WC_Site_Tracking {
|
|||
<!-- WooCommerce Tracks -->
|
||||
<script type="text/javascript">
|
||||
window.wcTracks = window.wcTracks || {};
|
||||
window.wcTracks.isEnabled = <?php echo self::is_tracking_enabled() ? 'true' : 'false'; ?>;
|
||||
window.wcTracks.recordEvent = function( name, properties ) {
|
||||
if ( ! window.wcTracks.isEnabled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var eventName = '<?php echo esc_attr( WC_Tracks::PREFIX ); ?>' + name;
|
||||
var eventProperties = properties || {};
|
||||
eventProperties.url = '<?php echo esc_html( home_url() ); ?>'
|
||||
|
|
Loading…
Reference in New Issue