Tracking selection of dropdown

Hi all,

I am looking for a way to track the selection for each of the multiple dropdowns I have in my webpage.

I have integrated MATOMO already to track everything else, but I need to adjust it so at to get the selection from every dropdown.

E.g. let’s say I have a dropdown called “Countries” and the available choices of “Germany”, “Italy”, “Spain”.

I need to count how many times Germany, Italy and Spain where selected.

Note: I have search for multiple tutorials etc, yet all of them talk about mouse clicks and button clicks, but I have not found anything regarding dropdown selections.

Hi @vagg77
I suggest not listen to dropdown change event, as if the user use the mouse wheel for the selection, you’ll catch too much events…
Instead, I think you could, on the “submission” event (or equivalent) either:

  • add a custom dimension to the submission event: the custom dimension will get the selected value in the dropdown list
  • send the dropdown selection event just before the “submission”

How do you track? (Matomo Tag Manager / standard JavaScript tracking / server log analysis…?)

Dear @heurteph-ei

Thank you for your reply.

I tried to do it using the Matomo Tag Manager, but I have not managed to grab the values from the dropdowns. In fact, I could not get it to work even with the click function.

Hi @vagg77
I am not sure the dropdown works well on the click event (You can change he value just with keyboard, for example).
With MTM, I suggest you do like following:
(and add the window._mtm.push(...) on the change event of the dropdown OR even better in my point of view, on the ‘submit’ / httprequest event)