mirror of
https://github.com/ReVanced/revanced-website.git
synced 2026-01-11 05:36:17 +00:00
fix: Make analytics work again
This commit is contained in:
@@ -9,16 +9,20 @@
|
|||||||
|
|
||||||
function enableAnalytics() {
|
function enableAnalytics() {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = [
|
||||||
function gtag(...args: any[]) {
|
{
|
||||||
//@ts-ignore
|
'gtm.start': new Date().getTime(),
|
||||||
window.dataLayer.push(args);
|
event: 'gtm.js'
|
||||||
}
|
}
|
||||||
gtag('js', new Date());
|
];
|
||||||
|
|
||||||
const script = document.createElement('script');
|
var firstScript = document.getElementsByTagName('script')[0];
|
||||||
script.src = `https://www.googletagmanager.com/gtm.js?id=${RV_GOOGLE_TAG_MANAGER_ID}`;
|
var script = document.createElement('script');
|
||||||
document.head.append(script);
|
script.async = true;
|
||||||
|
script.src = 'https://www.googletagmanager.com/gtm.js?id=' + RV_GOOGLE_TAG_MANAGER_ID;
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
firstScript.parentNode.insertBefore(script, firstScript);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleConsent(allowed: boolean) {
|
function handleConsent(allowed: boolean) {
|
||||||
|
|||||||
Reference in New Issue
Block a user