if (noninteraction === undefined) {
noninteraction = false;
}
- if (options === undefined) {
+ if (options === undefined || options === null) {
options = {};
}
options.non_interaction = noninteraction;
if (undefined !== value && null !== value) {
options.value = value;
}
-
- //console.log('gtag event', action, options);
-
- return (typeof gtag !== "undefined") ? gtag('event', action, options) : false;
+ return gtag('event', action, options)
};
cubistga.prototype.handleGtag = function (el) {
let value = el.getAttribute('data-ga-value');
let options = el.getAttribute('data-ga-options');
if (options !== null) {
- try {
- options = JSON.parse(options);
- }catch (e) {
- options={};
- }
+ options = JSON.parse(options);
}
return this.event(action, category, label, value, el.getAttribute('data-ga-noninteraction') === 1, options);