Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hey mcography

    Thank you for your post, it kind of make sense but is not working for me and you might be able to help me out.

    What I need to do is to add Google analytics event tracking to my menu items so I can know if people actually click on them or not.

    So what i did was creating the js file as you say but changed your on click event for my code so it looks like this.

    jQuery(document).ready(function($) {
    	$("#menu-item-211").on("click", function(e){
    	      e.preventDefault();
    	      // event tracking code here
    	      ga('send', 'event', 'category', 'action', 'label');
    	});
    });

    I also changed the menu item Id.

    Then I added the function to my function.php file and double checked that the path to the olark.js was correct

    But this is not working!

    What am i doing wrong? In theory, I should be able to see the onclick event on the menu item when I inspect the element.

    Hope you can help,

    Thank you

Viewing 1 replies (of 1 total)