Custom button&event tracking
Clients webpage has many buttons, but they want to track only one specific button. As I understand I need to add event tracking on the button and code would look like this:
But I also found that other coders to track specific button are using this one:
<button type="button" onclick="ga('send', 'event', 'button', 'click', 'phone-number-middle');" id="call-phone-middle"><i class="fa fa-phone"></i>Call us</button>
Could you share your best practises of tracking specific button? Thank you.
Re: Custom button&event tracking
If you are familiar with GA, then you can use, ga('send', 'event', 'button', 'click', 'phone-number-middle'), otherwise use the other one.
Will recommend to use the below one, will have slight better performance than the above one.
Here you are setting all the values in am object and then sending the object.
For better understanding, go through the below link