Complete novice and surprised to get this far, using google and youtube.
<script type="text/javascript">
window.onload = function() {
jQuery('.apply_now_green, .apply_now_red, .feat_lender img, .feat_lender h3').click(function() {
var label = jQuery(this).parents('.col-md-3').find('h3').text();
ga('send', 'event', 'apply now button', 'click', label);
});
};
</script>
<script type="text/javascript">
window.onload = function() {
jQuery('.more_details').click(function() {
var label = jQuery(this).parents('.col-md-3').find('h3').text();
ga('send', 'event', 'more details', 'click', label);
});
};
</script>
How can I merge the two, in the current format it wont work on analytics for tracking the two different events.
You can make use of HTML5 data attributes to save your Analytics category/other data on the element itself.
In jquery you can do something like this: