Current Path : /storage/v11800/lifespanstoresnew/public_html/wp-content/plugins/pinterest-for-woocommerce/assets/js/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/lifespanstoresnew/public_html/wp-content/plugins/pinterest-for-woocommerce/assets/js/pinterest-for-woocommerce-tracking.js |
/*global pintrk*/
/**
* Bind to search form submit in order to track the search event.
* Site search should use <form role='search'> to integrate with Pinterest for WooCommerce search event automatically.
*/
// eslint-disable-next-line @wordpress/no-global-event-listener
window.addEventListener( 'load', function () {
document
.querySelectorAll( "form[role='search']" )
.forEach( function ( form ) {
form.addEventListener( 'submit', function () {
if ( typeof pintrk !== 'function' ) {
return;
}
const searchBox = form.querySelector( "input[type='search']" );
if ( searchBox ) {
pintrk( 'track', 'search', {
search_query: searchBox.value,
} );
}
} );
} );
} );
//# sourceMappingURL=../source/_maps/js/pinterest-for-woocommerce-tracking.js.map