mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-01 18:00:26 +00:00
Improve custom scripts
This commit is contained in:
@@ -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,
|
||||
});
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user