Analytics
3.6K members online now
3.6K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Tracking multiple select boxes and values

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,


I have a page with 5 select boxes and 1 search field. This is not a form, so i can't create a form listener unless i use the datalayer & gtm (do not perform a submit event). What i'd like to figure out is how i can attach a ga event to each item in the select boxes and dynamically populate the event action and event label based on the which selection box and its associated item was selected. 

 

here's what i have so far. As you can see, i am able to dynmically populdate the label, but not action (currently hardcoded as "Select Changed")

<select onChange="ga('send', 'event', ‘SessionFilters’, 'Select Changed', this.options[this.selectedIndex].text);">
<option selected="selected">All</option>
<option value="1">USA</option>
<option value="2">Canada</option>
<option value="3">UK</option>
<option value="4">Australia</option>
</select>

 

Thank you in advance,

Udi

1 Expert replyverified_user

Tracking multiple select boxes and values

Top Contributor
# 2
Top Contributor

Hi,

 

This would put option value to the event action field:

 

<select onChange="ga('send', 'event', 'SessionFilters', this.options[this.selectedIndex].value, this.options[this.selectedIndex].text);">

 

Please let me know if this is what you need.

 


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Tracking multiple select boxes and values

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi,

Hymmm.. I am not clear how based on this, the action would pull the name of the field. Meaning, how does it differentiate between the name of the field and the item selected?