OSDN Git Service

update google-analysis
authorZhiting Lin <zlin035@uottawa.ca>
Tue, 3 Nov 2020 06:37:54 +0000 (14:37 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Tue, 3 Nov 2020 06:37:54 +0000 (14:37 +0800)
src/ga.js [new file with mode: 0644]
src/manifest.js
src/popup.js
src/prompt.js

diff --git a/src/ga.js b/src/ga.js
new file mode 100644 (file)
index 0000000..4529c5d
--- /dev/null
+++ b/src/ga.js
@@ -0,0 +1,10 @@
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
+
+ga('create', 'UA-132067533-1', 'auto');
+
+// Modifications:
+ga('set', 'checkProtocolTask', null); // Disables file protocol checking.
+ga('send', 'pageview', '/popup'); // Set page, avoiding rejection due to chrome-extension protocol
index b736e53..cd71ede 100644 (file)
@@ -23,7 +23,7 @@ module.exports = {
     'clipboardRead',
     'background'
   ],
-  content_security_policy: "script-src 'self' 'unsafe-eval'; object-src 'self'",
+  content_security_policy: "script-src 'self'  'unsafe-eval' https://www.google-analytics.com/analytics.js; object-src 'self'",
   content_scripts: [
     {
       js: ['js/content.js'],
index 4f73f0c..e02e82c 100644 (file)
@@ -1,3 +1,4 @@
+import './ga.js'
 import Vue from 'vue'
 import moment from 'moment'
 import VueI18n from 'vue-i18n'
index 27fd979..1d58225 100644 (file)
@@ -1,3 +1,4 @@
+import './ga.js'
 import Vue from 'vue'
 import moment from 'moment'
 import VueI18n from 'vue-i18n'