fix: adapt event_tracking.js to gtag`
This commit is contained in:
parent
d085a7d5c2
commit
924bc71a33
|
@ -11,7 +11,15 @@ ckan.module("google-analytics", function(jQuery, _) {
|
|||
|
||||
var resource_url = encodeURIComponent(jQuery(this).prop("href"));
|
||||
if (resource_url) {
|
||||
ga("send", "event", "Resource", "Download", resource_url);
|
||||
if (typeof ga === "undefined") {
|
||||
gtag('event', "Download", {
|
||||
'event_category': "Resource",
|
||||
'event_label': resource_url,
|
||||
});
|
||||
} else {
|
||||
ga("send", "event", "Resource", "Download", resource_url);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue