mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 03:52:50 +00:00
feat: 官网新增谷歌分析代码
This commit is contained in:
parent
700d566255
commit
a253d42f10
29
public/site/js/common.js
vendored
29
public/site/js/common.js
vendored
@ -203,19 +203,32 @@ const openInNewTab = (url)=> {
|
|||||||
// 引入谷歌分析代码
|
// 引入谷歌分析代码
|
||||||
let scriptElement = document.createElement('script');
|
let scriptElement = document.createElement('script');
|
||||||
scriptElement.async = true;
|
scriptElement.async = true;
|
||||||
scriptElement.src = 'https://www.googletagmanager.com/gtag/js?id=AW-16660800396"';
|
scriptElement.src = 'https://www.googletagmanager.com/gtag/js?id=AW-16660800396';
|
||||||
|
let scriptElement1 = document.createElement('script');
|
||||||
|
scriptElement1.async = true;
|
||||||
|
scriptElement1.src = 'https://www.googletagmanager.com/gtag/js?id=G-PE77P6491J';
|
||||||
|
|
||||||
// 在 script 元素加载完成后执行的回调函数
|
// 在 script 元素加载完成后执行的回调函数
|
||||||
scriptElement.onload = function() {
|
scriptElement.onload = function() {
|
||||||
let customScript = document.createElement('script');
|
let customScript = document.createElement('script');
|
||||||
customScript.textContent = `
|
customScript.textContent = `
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
function gtag(){dataLayer.push(arguments);}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
gtag('config', 'AW-16660800396');`
|
gtag('config', 'AW-16660800396');`
|
||||||
document.head.appendChild(customScript);
|
document.head.appendChild(customScript);
|
||||||
|
};
|
||||||
|
scriptElement1.onload = function() {
|
||||||
|
let customScript = document.createElement('script');
|
||||||
|
customScript.textContent = `
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
gtag('js', new Date());
|
||||||
|
gtag('config', 'G-PE77P6491J'); `
|
||||||
|
document.head.appendChild(customScript);
|
||||||
};
|
};
|
||||||
// 将 script 元素插入到文档的 head 元素中
|
// 将 script 元素插入到文档的 head 元素中
|
||||||
document.head.appendChild(scriptElement);
|
document.head.appendChild(scriptElement);
|
||||||
|
document.head.appendChild(scriptElement1);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user