mirror of
https://github.com/ritz078/transform.git
synced 2026-11-20 16:22:53 +03:00
added ga (#107)
* fixes * make monaco workers available in static folder * fixes * fixes * fix(worker): monaco workers path * chore(ga): added google analytics
This commit is contained in:
1 parent
eb68108b67
commit
8f28ba28ec
1 file changed
+11
-8
+11
-8
@@ -8,15 +8,19 @@ interface DocumentProps {
|
||||
}
|
||||
|
||||
function trackingScript() {
|
||||
window["dataLayer"] = window["dataLayer"] || [];
|
||||
// @ts-ignore
|
||||
if (window.dataLayer) return;
|
||||
// @ts-ignore
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() {
|
||||
window["dataLayer"].push(arguments);
|
||||
// @ts-ignore
|
||||
window.dataLayer.push(arguments);
|
||||
}
|
||||
// @ts-ignore
|
||||
gtag("js", new Date());
|
||||
|
||||
// @ts-ignore
|
||||
gtag("config", "UA-60624235-5");
|
||||
gtag("config", "UA-60624235-8");
|
||||
}
|
||||
|
||||
export default class MyDocument extends Document<DocumentProps> {
|
||||
@@ -31,10 +35,6 @@ export default class MyDocument extends Document<DocumentProps> {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount(): void {
|
||||
trackingScript();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { css, hydrationScript } = this.props;
|
||||
|
||||
@@ -56,8 +56,11 @@ export default class MyDocument extends Document<DocumentProps> {
|
||||
|
||||
<script
|
||||
async
|
||||
src="https://www.googletagmanager.com/gtag/js?id=UA-60624235-5"
|
||||
src="https://www.googletagmanager.com/gtag/js?id=UA-60624235-8"
|
||||
/>
|
||||
<script>
|
||||
<>{IN_BROWSER && trackingScript()}</>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user