Sending click events to Google Analytics in WordPress: the easy way

This is working in my WordPress site. Remember we are using the plugin “Per page head”, which allows you to add content into the section for a specific page, like custom JS or custom HTML. This is the custom code added: <script>// <![CDATA[ jQuery(document).ready(function($){ $(‘.class-name-of-the-button’).click(function() { ga(‘send’, ‘event’, { eventCategory: ‘Outbound Link’, eventAction: ‘click’, eventLabel: … Read more

AJAX pagination, update current page

When you refresh the page, there is currently no state you can use to know you’re on page 2. You could use the History API to update the page URL without refreshing the page: history.pushState(data, title, ‘https://yourpage.com/?page=2’); You can also set some state on the user browser using the SessionStorage instead of the LocalStorage API, … Read more

In WooCommerce product archive, how can you also set the quantity to be added to cart by typing, instead of just by using +/-?

If using this plugin instead of the theme functionality, and in the same time except jquery from minification and grouping, it works: Quantity Field on Shop Page for WooCommerce https://wordpress.org/plugins/quantity-field-on-shop-page-for-woocommerce/ It seems that jQuery has to be excepted from minification and grouping because otherwise the code starting with this gives an error: <script type=”text/javascript”>jQuery(‘.products .post-10 … Read more