Improve custom scripts

This commit is contained in:
Hazem Krimi
2022-02-13 19:52:54 +01:00
parent d32afe310d
commit 4025ee960b
4 changed files with 67 additions and 65 deletions
+13
View File
@@ -17,3 +17,16 @@ export const event = ({ action, category, label, value }: any) => {
value: value
});
};
export const initAnalytics = () => `
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', ${GOOGLE_ANALYTICS_KEY}, {
page_path: window.location.pathname,
});
`;