Highlighted

Jquery Event tracking on clicking on-Page Button submission

Bronze Contributor
Bronze Contributor

I need to track on-page button click as illustrated in the following image Click Here

The visitor need to :

 

1. Select button online or Mail

2. Go to the bottom of the page and Click Save

 

I need to track it as an event 

 

So the event lable would be Online or Mail.

 

Please advise.

 

Thanks

 

3 REPLIES 3
Highlighted

Jquery Event tracking on clicking on-Page Button submission

Employee Emeritus

Hello @michel_mitri. Do you have a URL to the page that's in the screenshot there?

Jquery Event tracking on clicking on-Page Button submission

Bronze Contributor
Bronze Contributor
It's a secure page that requires username and password to access.

I can provide you with the source code of the page if that can help.

Please advise


Thanks
Highlighted

Jquery Event tracking on clicking on-Page Button submission

Employee Emeritus

@michel_mitri from what it sounds like, this may involve writing your own custom Javascript Extension.  From the scenario you described, you will have to run the following logic:

 

1. Add an on-handler event listener to the "Save" button (i.e. mousedown, click or submit, )

2. On the event, you must write a script to check whether "Online" or "Mail" is selected.

3. After the check, you must fire a "utag.link()" call while passing an object as its argument.

4. The object will have the values you'd like to pass for your tag (i.e. { event_label : "online", event_action : "click", event_category : "button" } )

 

Note, the event_label value ("online" or "mail") will be dependent on your source code and how your DOM-elements are structured.

 

The utag.link call itself will look something like this:

 

utag.link({
  event_action : "click",
  event_category : "button",
  event_label : "online"
});

 

Hope this helps.