From 07a0b712d76b9a36216c696aed894aa780603352 Mon Sep 17 00:00:00 2001 From: Andrea Vos Date: Wed, 15 Feb 2023 19:59:18 +0100 Subject: [PATCH] [ads] GTM --- layouts/default.vue | 13 ++++++++++++- locale/_base/translations.suml | 3 +++ locale/en/translations.suml | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/layouts/default.vue b/layouts/default.vue index a49fd0e3f..b7105ccbd 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -63,6 +63,7 @@ this.confirmAge(); this.loadAds(); + this.loadGTM(); }, methods: { async confirmAge() { @@ -81,7 +82,17 @@ if (!this.adsEnabled) { return; } await this.$loadScript('adsense', `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8518361481036191`); - } + }, + async loadGTM() { + if (!this.adsEnabled) { return; } + + await this.$loadScript('gtm', 'https://www.googletagmanager.com/gtag/js?id=G-TDJEP12Q3M'); + + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); + gtag('config', 'G-TDJEP12Q3M'); + }, }, computed: { adsEnabled() { diff --git a/locale/_base/translations.suml b/locale/_base/translations.suml index cf38fdb39..a9065b438 100644 --- a/locale/_base/translations.suml +++ b/locale/_base/translations.suml @@ -962,6 +962,9 @@ privacy: plausible: > We use Plausible to analyse traffic on the website. Such data has no relation to your username, and your IP is anonymised. You can read their privacy policy {https://plausible.io/privacy=here}. + gtm: > + We use Google Tag Manager to analyse traffic on the website. Such data has no relation to your username. + You can read their privacy policy {https://support.google.com/tagmanager/answer/9323295=here}. arc: > We use arc.io to cover the costs of website maintenance without introducing ads. You can read more about them and their privacy policy diff --git a/locale/en/translations.suml b/locale/en/translations.suml index 1b67aeee3..10ee1c7b5 100644 --- a/locale/en/translations.suml +++ b/locale/en/translations.suml @@ -1100,6 +1100,9 @@ privacy: plausible: > We use Plausible to analyse traffic on the website. Such data has no relation to your username, and your IP is anonymised. You can read their privacy policy {https://plausible.io/privacy=here}. + gtm: > + We use Google Tag Manager to analyse traffic on the website. Such data has no relation to your username. + You can read their privacy policy {https://support.google.com/tagmanager/answer/9323295=here}. arc: > We use arc.io to cover the costs of website maintenance without introducing ads. You can read more about them and their privacy policy