I would like to track an onclick of a button on a page on a site, after a condition is passed checking if a cookie is present.
Very simple but which syn
I would create a function if you need to track different events, that way your code will be cleaner.
analytics.js
ga.js
function TrackEventGA(Category, Action, Label, Value) {
"use strict";
if (typeof (_gaq) !== "undefined") {
_gaq.push(['_trackEvent', Category, Action, Label, Value]);
} else if (typeof (ga) !== "undefined") {
ga('send', 'event', Category, Action, Label, Value);
}
}
TrackEventGA('QR_Win_A_Grand', 'Clicked_through_to_register');