fbq('init', '2846271042179391', {}, {
"agent": "woocommerce_6-10.4.2-3.5.15"
});
document.addEventListener( 'DOMContentLoaded', function() {
// Insert placeholder for events injected when a product is added to the cart through AJAX.
document.body.insertAdjacentHTML( 'beforeend', '<div class=\"wc-facebook-pixel-event-placeholder\"></div>' );
}, false );
( function( w, d, s, l, i ) {
w[l] = w[l] || [];
w[l].push( {'gtm.start': new Date().getTime(), event: 'gtm.js'} );
var f = d.getElementsByTagName( s )[0],
j = d.createElement( s ), dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://mbaseballacademy.com/wp-content/uploads/breeze/google/gtm.js?id=' + i + dl;
f.parentNode.insertBefore( j, f );
} )( window, document, 'script', 'dataLayer', 'GTM-PX3FVZGB' );
tvc_js = new TVC_GTM_Enhanced({"affiliation":"Marietta Baseball Academy","is_admin":"","tracking_option":"","property_id":"","measurement_id":"","google_ads_id":"","fb_pixel_id":"","fb_event_id":"2f8de9b9ba04473f8fa4ef6333068205","tvc_ajax_url":"https:\/\/mbaseballacademy.com\/wp-admin\/admin-ajax.php","is_global_fs_enabled":null});
/*
* Contact form 7 - formSubmit event
*/
var wpcf7Elm = document.querySelector('.wpcf7');
if (wpcf7Elm) {
wpcf7Elm.addEventListener('wpcf7submit', function(event) {
if (event.detail.status == 'mail_sent') {
tvc_js.formsubmit_cf7_tracking(event);
}
}, false);
}
/*
* Global - jjQuery event handler that is triggered when an AJAX request completes successfully.
*/
jQuery(document).ajaxSuccess(function(event, xhr, settings) {
// WpForm - formSubmit event
if (settings.data instanceof FormData) {
var formdata = [];
for (var pair of settings.data.entries()) {
if ('form_id' in formdata && 'action' in formdata)
break;
if (pair[0] == 'wpforms[id]')
formdata['form_id'] = pair[1];
if (pair[0] == 'action' && pair[1] == 'wpforms_submit')
formdata['action'] = pair[1];
}
if (formdata['action'] == 'wpforms_submit' && settings.data != 'action=datalayer_push') {
var data = [];
tvc_js.formsubmit_ajax_tracking(formdata);
return;
}
}
});
document.addEventListener('DOMContentLoaded', function() {
var downloadLinks = document.querySelectorAll('a[href]');
downloadLinks.forEach(function(link) {
link.addEventListener('click', function(event) {
var fileUrl = link.href;
var fileName = fileUrl.substring(fileUrl.lastIndexOf('/') + 1);
var linkText = link.innerText || link.textContent;
var linkUrl = link.href;
var fileExtensionPattern = /\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pptx?|ppt|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/i;
if (fileExtensionPattern.test(fileUrl)) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'file_download',
file_name: fileName,
link_text: linkText,
link_url: linkUrl
});
}
});
});
});
( function() {
var skipLinkTarget = document.querySelector( 'main' ),
sibling,
skipLinkTargetID,
skipLink;
// Early exit if a skip-link target can't be located.
if ( ! skipLinkTarget ) {
return;
}
/*
* Get the site wrapper.
* The skip-link will be injected in the beginning of it.
*/
sibling = document.querySelector( '.wp-site-blocks' );
// Early exit if the root element was not found.
if ( ! sibling ) {
return;
}
// Get the skip-link target's ID, and generate one if it doesn't exist.
skipLinkTargetID = skipLinkTarget.id;
if ( ! skipLinkTargetID ) {
skipLinkTargetID = 'wp--skip-link--target';
skipLinkTarget.id = skipLinkTargetID;
}
// Create the skip link.
skipLink = document.createElement( 'a' );
skipLink.classList.add( 'skip-link', 'screen-reader-text' );
skipLink.id = 'wp-skip-link';
skipLink.href = '#' + skipLinkTargetID;
skipLink.innerText = 'Skip to content';
// Inject the skip link.
sibling.parentElement.insertBefore( skipLink, sibling );
}() );
//# sourceURL=wp-block-template-skip-link-js-after
var iconic_wsb_frontend_vars = {"ajax_url":"/wp-admin/admin-ajax.php","nonce":"23a7eed49f","fbt_use_ajax":"1","is_checkout":"","i18n":{"error":"Please Try Again","success":"Added to Cart","add_selected":"Add Selected to Cart","disabled_add_to_cart":"Please select a variation before adding the selected products to your cart."},"modal_options":{"showCloseBtn":false}};
//# sourceURL=iconic_wsb_frontend_scripts-js-extra
(function() {
window.wcAnalytics = window.wcAnalytics || {};
const wcAnalytics = window.wcAnalytics;
// Set the assets URL for webpack to find the split assets.
wcAnalytics.assets_url = 'https://mbaseballacademy.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/woocommerce-analytics/src/../build/';
// Set the REST API tracking endpoint URL.
wcAnalytics.trackEndpoint = 'https://mbaseballacademy.com/wp-json/woocommerce-analytics/v1/track';
// Set common properties for all events.
wcAnalytics.commonProps = {"blog_id":214105619,"store_id":"9e9485fd-e095-4895-b00c-6f417d1ee0ad","ui":null,"url":"https://mbaseballacademy.com","woo_version":"10.4.2","wp_version":"6.9","store_admin":0,"device":"desktop","store_currency":"USD","timezone":"-04:00","is_guest":1};
// Set the event queue.
wcAnalytics.eventQueue = [];
// Features.
wcAnalytics.features = {
ch: false,
sessionTracking: false,
proxy: false,
};
wcAnalytics.breadcrumbs = ["Premium Baseball Hitting Drills"];
// Page context flags.
wcAnalytics.pages = {
isAccountPage: false,
isCart: false,
};
})();
// Listen for clicks on the entire document
document.addEventListener('click', function(event) {
console.log(event.target.dataset)
// Check if the clicked element has the 'track-click' class
if (event.target.classList.contains('trk-clk-ulbp')) {
// Get the unique ID from the data-id attribute
const elementTxt = event.target.dataset.btntxt;
const elementUrl = event.target.dataset.btnhref;
// Create a FormData object to send data
const formData = new FormData();
formData.append('clicked_element_text', elementTxt);
formData.append('clicked_element_url', elementUrl);
formData.append('clicked_element_psid', 19855);
//console.log(formData.get('clicked_element_psid'));
// Use the Fetch API to send the data to our PHP script
fetch(
"https://mbaseballacademy.com/wp-admin/admin-ajax.php?action=ulpb_rc_current_usr_click&POPB_CTA_Nonce=0972b3ed1f"
, {
method: 'POST',
body: formData
})
.then(response => response.text())
.then(data => {
console.log(data); // Log the response from PHP (e.g., "Success!")
})
.catch(error => {
console.error('Error tracking click:', error);
});
}
});