Skip to content

Instantly share code, notes, and snippets.

@sumonst21
Forked from jwebgordon/clickTrackEvents.js
Created April 20, 2022 09:14
Show Gist options
  • Save sumonst21/93a79cc3a471b7e101961f3b19bfc2df to your computer and use it in GitHub Desktop.
Save sumonst21/93a79cc3a471b7e101961f3b19bfc2df to your computer and use it in GitHub Desktop.
Custom JS to add click track event listeners to all elements of a particular class This should be added to the Custom Javascript in Hubspot Events
var all_buttons = $('.buttons');
for(var i=0; i<all_buttons.length; i++){
_hsq.push(["trackClick", "#"+all_buttons.eq(i).attr('id'), "test2"+all_buttons.eq(i).attr('id')]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment