1

I have a WebPage page that has lots of checkboxes on. Each one does something different. I would like to know which of these checkboxes is most popular with users.

I am aware that I can assign Analytics Events by class to these checkboxes but that would either require me to:

  • Give every checkbox the same class and assign a blanket event
  • Create a new event for every checkbox, using a different class each time

If i were to go with the former and give every checkbox the same class, is there a way in the Analytics dashboard to disaggregate those events by the checkbox ID, or some other variable that differentiates them from each-other?

Equally, is there a better, alternative, way of approaching this?

3
  • Google Analytics events don't usually have anything to do with CSS classes. You can send events based on any criteria you can code in JavaScript. – Stephen Ostermiller Mar 1 at 18:53
  • Apologies - should have been clearer. I'm talking about HTML element classes, as opposed to CSS classes. – Jamie Mar 2 at 19:48
  • I just now noticed you mentioned HTML classes vs CSS classes, however, I'm pretty sure they are one and the same. – Tal Apr 7 at 8:31
1

You can actually give them all the same class name, but a different id. Then, when firing the Event based on the class, and then, in the label attribute of the Event specify the id, therefore aggregating all the events under the same category and action but differentiating them based on the specific checkbox. See this GTM article's "Clicks on any element" for a practical example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.