This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use whatever selectors you want to track, e.g. "a.trackMe"
jQuery('.gaTrack, button, a.button, input[type="submit"], input[type="button"], input[type="reset"], .wp-block-button__link, .menu-item a, .menu a, li a').on('click', function() {
// what was clicked?
var name = jQuery(this).text();
// assuming Google Analytics is already loaded, fire event log
hi,
Just a quick question if using gtag.js should the event be written like this:
gtag('event','click'{'event_category':'button', 'event_label':name});
instead of
ga('send', 'event', 'button', 'click', name);
Thanks,
Rob