fix: ga is not defined
This commit is contained in:
@@ -14,13 +14,17 @@ export default class Analytics {
|
|||||||
metadata?: Record<string, string>
|
metadata?: Record<string, string>
|
||||||
) => {
|
) => {
|
||||||
// GA3
|
// GA3
|
||||||
ga?.("send", "event", event, action);
|
if (window.ga) {
|
||||||
|
window.ga("send", "event", event, action);
|
||||||
|
}
|
||||||
|
|
||||||
// GA4
|
// GA4
|
||||||
window.dataLayer?.push({
|
if (window.dataLayer) {
|
||||||
event,
|
window.dataLayer.push({
|
||||||
action,
|
event,
|
||||||
...metadata,
|
action,
|
||||||
});
|
...metadata,
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user