gitbook-plugin-statistics
Advanced tools
Comparing version 1.0.17 to 1.0.18
@@ -7,2 +7,4 @@ require(["gitbook", 'jQuery'], function(gitbook, $) { | ||
let cnzzUrl; | ||
let googleUrl; | ||
let googleId; | ||
@@ -30,2 +32,14 @@ function insertStatisticsScript() { | ||
// $('body').append(res); | ||
}; | ||
if (googleId !== 0) { | ||
const res = " <script async src='https://www.googletagmanager.com/gtag/js?id='"+googleId+"></script>\n" + | ||
" <script>\n" + | ||
" window.dataLayer = window.dataLayer || [];\n" + | ||
" function gtag(){dataLayer.push(arguments);}\n" + | ||
" gtag('js', new Date());\n" + | ||
"\n" + | ||
" gtag('config', '"+googleId+"');\n" + | ||
" </script>"; | ||
$('book-body').append(res); | ||
} | ||
@@ -39,8 +53,9 @@ } | ||
cnzzUrl = config.statistics.cnzz_url || ""; | ||
googleId = config.statistics.google_id || 0; | ||
googleUrl = config.statistics.google_url || ""; | ||
insertStatisticsScript() | ||
}); | ||
// gitbook.events.bind('page.change', function() { | ||
// insertStatisticsScript(); | ||
// }); | ||
gitbook.events.bind('page.change', function() { | ||
insertStatisticsScript(); | ||
}); | ||
}); |
{ | ||
"name": "gitbook-plugin-statistics", | ||
"version": "v1.0.17", | ||
"version": "v1.0.18", | ||
"description": "Gitbook 数据统计插件", | ||
@@ -44,6 +44,16 @@ "main": "index.js", | ||
"type": "string" | ||
}, | ||
"google_url": { | ||
"description": "google分析js地址", | ||
"default":"https://www.googletagmanager.com/gtag/js", | ||
"required": false, | ||
"type": "string" | ||
}, | ||
"google_id": { | ||
"description": "google分析跟踪ID", | ||
"required": false, | ||
"type": "int" | ||
} | ||
} | ||
} | ||
} |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
4490
58