From 6554fb800b0c0c4f3f8e3298b61f8f394e0f466a Mon Sep 17 00:00:00 2001 From: Eko Zhan Date: Wed, 29 Dec 2021 09:27:23 +0000 Subject: [PATCH 1/9] feat: add google analytics gtag.js plugin --- src/plugins/gtag.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/plugins/gtag.js diff --git a/src/plugins/gtag.js b/src/plugins/gtag.js new file mode 100644 index 000000000..b1a8e5b18 --- /dev/null +++ b/src/plugins/gtag.js @@ -0,0 +1,43 @@ +/* eslint-disable no-console */ +// copy from ./ga.js +// usage is the same as ./ga.js +function appendScript(id) { + const script = document.createElement('script'); + script.async = true; + script.src = 'https://www.googletagmanager.com/gtag/js?id=' + id; + document.body.appendChild(script); +} + +function init(id) { + appendScript(id); + + window.dataLayer = window.dataLayer || []; + window.gtag = window.gtag || function () { dataLayer.push(arguments); } + + gtag('js', new Date()); + gtag('config', id); +} + +function collect() { + if (!window.ga) { + init($docsify.ga); + } + + // usage: https://developers.google.com/analytics/devguides/collection/gtagjs/pages + window.gtag('event', 'page_view', { + page_title: document.title, + page_location: location.href, + page_path: location.pathname + }) +} + +const install = function (hook) { + if (!$docsify.ga) { + console.error('[Docsify] ga is required.'); + return; + } + + hook.beforeEach(collect); +}; + +$docsify.plugins = [].concat(install, $docsify.plugins); From b3eeeedb6dae54d79249d3d9dc6930c917aab048 Mon Sep 17 00:00:00 2001 From: Eko Zhan Date: Tue, 4 Jan 2022 05:53:18 +0000 Subject: [PATCH 2/9] feat: add google universal analytics gtag.js plugin --- build/build.js | 1 + docs/plugins.md | 22 ++++++++++++++++++++++ src/plugins/gtag.js | 18 +++++++++++------- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/build/build.js b/build/build.js index 0de786828..91155512a 100644 --- a/build/build.js +++ b/build/build.js @@ -80,6 +80,7 @@ async function buildAllPlugin() { var plugins = [ {name: 'search', input: 'search/index.js'}, {name: 'ga', input: 'ga.js'}, + {name: 'gtag', input: 'gtag.js'}, {name: 'matomo', input: 'matomo.js'}, {name: 'emoji', input: 'emoji.js'}, {name: 'external-script', input: 'external-script.js'}, diff --git a/docs/plugins.md b/docs/plugins.md index b7ccb971f..811f66dbb 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -89,6 +89,28 @@ Configure by `data-ga`. ``` +## Google Universal Analytics (gtag.js) + +Usage is same as `Google Analytics`. + +```html + + + +``` + +Configure by `data-ga`. + +```html + + +``` + + ## emoji The default is to support parsing emoji. For example `:100:` will be parsed to :100:. But it is not precise because there is no matching non-emoji string. If you need to correctly parse the emoji string, you need install this plugin. diff --git a/src/plugins/gtag.js b/src/plugins/gtag.js index b1a8e5b18..aa763fa86 100644 --- a/src/plugins/gtag.js +++ b/src/plugins/gtag.js @@ -12,10 +12,14 @@ function init(id) { appendScript(id); window.dataLayer = window.dataLayer || []; - window.gtag = window.gtag || function () { dataLayer.push(arguments); } - - gtag('js', new Date()); - gtag('config', id); + window.gtag = + window.gtag || + function() { + window.dataLayer.push(arguments); + }; + + window.gtag('js', new Date()); + window.gtag('config', id); } function collect() { @@ -27,11 +31,11 @@ function collect() { window.gtag('event', 'page_view', { page_title: document.title, page_location: location.href, - page_path: location.pathname - }) + page_path: location.pathname, + }); } -const install = function (hook) { +const install = function(hook) { if (!$docsify.ga) { console.error('[Docsify] ga is required.'); return; From 5a05b30ec3bae7fa7cb6c1a10d92f333b0bcabcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=94=81?= <52o@qq52o.cn> Date: Wed, 16 Mar 2022 07:58:47 +0800 Subject: [PATCH 3/9] Update gtag.js --- src/plugins/gtag.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/gtag.js b/src/plugins/gtag.js index aa763fa86..6fedda861 100644 --- a/src/plugins/gtag.js +++ b/src/plugins/gtag.js @@ -14,7 +14,7 @@ function init(id) { window.dataLayer = window.dataLayer || []; window.gtag = window.gtag || - function() { + function () { window.dataLayer.push(arguments); }; @@ -35,7 +35,7 @@ function collect() { }); } -const install = function(hook) { +const install = function (hook) { if (!$docsify.ga) { console.error('[Docsify] ga is required.'); return; From b3a8703ebe6a46f31ddff40ec9e3ad4ae938bfd1 Mon Sep 17 00:00:00 2001 From: Eko Zhan Date: Sun, 24 Apr 2022 23:04:34 +0800 Subject: [PATCH 4/9] feat: add google universal analytics gtag.js plugin --- build/build.js | 1 - docs/plugins.md | 31 +++++++++---------------- src/plugins/ga.js | 55 +++++++++++++++++++++++++++++++++++---------- src/plugins/gtag.js | 47 -------------------------------------- 4 files changed, 53 insertions(+), 81 deletions(-) delete mode 100644 src/plugins/gtag.js diff --git a/build/build.js b/build/build.js index 91155512a..0de786828 100644 --- a/build/build.js +++ b/build/build.js @@ -80,7 +80,6 @@ async function buildAllPlugin() { var plugins = [ {name: 'search', input: 'search/index.js'}, {name: 'ga', input: 'ga.js'}, - {name: 'gtag', input: 'gtag.js'}, {name: 'matomo', input: 'matomo.js'}, {name: 'emoji', input: 'emoji.js'}, {name: 'external-script', input: 'external-script.js'}, diff --git a/docs/plugins.md b/docs/plugins.md index bdbeb88dd..0e60b1944 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -78,6 +78,16 @@ Install the plugin and configure the track id. window.$docsify = { ga: 'UA-XXXXX-Y', }; + + // or multi gtag + window.$docsify = { + ga: [ + 'G-XXXXXXXX', // Google Analytics 4 (GA4) + 'UA-XXXXXXXX', // Google Universal Analytics (GA3) + 'AW-XXXXXXXX', // Google Ads + 'DC-XXXXXXXX' // Floodlight + ], + }; @@ -91,27 +101,6 @@ Configure by `data-ga`. ``` -## Google Universal Analytics (gtag.js) - -Usage is same as `Google Analytics`. - -```html - - - -``` - -Configure by `data-ga`. - -```html - - -``` - ## Emoji Renders a larger collection of emoji shorthand codes. Without this plugin, Docsify is able to render only a limited number of emoji shorthand codes. diff --git a/src/plugins/ga.js b/src/plugins/ga.js index 37167a4dc..4b24a24d8 100644 --- a/src/plugins/ga.js +++ b/src/plugins/ga.js @@ -1,22 +1,49 @@ /* eslint-disable no-console */ // From https://github.com/egoist/vue-ga/blob/master/src/index.js -function appendScript() { + +function appendScript(id) { const script = document.createElement('script'); script.async = true; - script.src = 'https://www.google-analytics.com/analytics.js'; + script.src = 'https://www.googletagmanager.com/gtag/js?id=' + id; document.body.appendChild(script); } -function init(id) { - appendScript(); - window.ga = - window.ga || +// global site tag instance initialized +function initGlobalSiteTag(id){ + appendScript(id); + + window.dataLayer = window.dataLayer || []; + window.gtag = + window.gtag || function () { - (window.ga.q = window.ga.q || []).push(arguments); + window.dataLayer.push(arguments); }; - window.ga.l = Number(new Date()); - window.ga('create', id, 'auto'); + window.gtag('js', new Date()); + window.gtag('config', id); +} + +// add additional products to your tag +// https://developers.google.com/tag-platform/gtagjs/install +function initAdditionalTag(id){ + window.gtag('config', id); +} + +function init(ids) { + if (Array.isArray(ids)){ + + // the first id must be a global site tag id + initGlobalSiteTag(ids[0]); + + // the rest ids + ids.forEach((id, index)=>{ + if (index > 0){ + initAdditionalTag(id); + } + }) + } else { + initGlobalSiteTag(ids); + } } function collect() { @@ -24,8 +51,12 @@ function collect() { init($docsify.ga); } - window.ga('set', 'page', location.hash); - window.ga('send', 'pageview'); + // usage: https://developers.google.com/analytics/devguides/collection/gtagjs/pages + window.gtag('event', 'page_view', { + page_title: document.title, + page_location: location.href, + page_path: location.pathname, + }); } const install = function (hook) { @@ -37,4 +68,4 @@ const install = function (hook) { hook.beforeEach(collect); }; -$docsify.plugins = [].concat(install, $docsify.plugins); +$docsify.plugins = [].concat(install, $docsify.plugins); \ No newline at end of file diff --git a/src/plugins/gtag.js b/src/plugins/gtag.js deleted file mode 100644 index 6fedda861..000000000 --- a/src/plugins/gtag.js +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-disable no-console */ -// copy from ./ga.js -// usage is the same as ./ga.js -function appendScript(id) { - const script = document.createElement('script'); - script.async = true; - script.src = 'https://www.googletagmanager.com/gtag/js?id=' + id; - document.body.appendChild(script); -} - -function init(id) { - appendScript(id); - - window.dataLayer = window.dataLayer || []; - window.gtag = - window.gtag || - function () { - window.dataLayer.push(arguments); - }; - - window.gtag('js', new Date()); - window.gtag('config', id); -} - -function collect() { - if (!window.ga) { - init($docsify.ga); - } - - // usage: https://developers.google.com/analytics/devguides/collection/gtagjs/pages - window.gtag('event', 'page_view', { - page_title: document.title, - page_location: location.href, - page_path: location.pathname, - }); -} - -const install = function (hook) { - if (!$docsify.ga) { - console.error('[Docsify] ga is required.'); - return; - } - - hook.beforeEach(collect); -}; - -$docsify.plugins = [].concat(install, $docsify.plugins); From 9e43564ba100ccc6703a9b39619f28949171afc4 Mon Sep 17 00:00:00 2001 From: Eko Zhan Date: Mon, 25 Apr 2022 12:06:42 +0800 Subject: [PATCH 5/9] feat: add google universal analytics gtag.js plugin --- docs/plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins.md b/docs/plugins.md index 0e60b1944..d8c81c769 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -79,7 +79,7 @@ Install the plugin and configure the track id. ga: 'UA-XXXXX-Y', }; - // or multi gtag + // or multi gtag, the first element of the array must be a global site gtag id, each page should have only one global site tag instance. window.$docsify = { ga: [ 'G-XXXXXXXX', // Google Analytics 4 (GA4) From c97b35bb53322ea18d1470f127073270c4f40902 Mon Sep 17 00:00:00 2001 From: Eko Zhan Date: Tue, 24 May 2022 21:54:48 +0800 Subject: [PATCH 6/9] feat: add google universal analytics gtag.js plugin --- docs/plugins.md | 8 ++++---- src/plugins/ga.js | 33 ++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/docs/plugins.md b/docs/plugins.md index d8c81c769..857243794 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -78,14 +78,14 @@ Install the plugin and configure the track id. window.$docsify = { ga: 'UA-XXXXX-Y', }; - - // or multi gtag, the first element of the array must be a global site gtag id, each page should have only one global site tag instance. + + // or multi gtag, first tag at the beginning of G- from the array is global site gtag, each page should have only one global site tag instance. window.$docsify = { ga: [ 'G-XXXXXXXX', // Google Analytics 4 (GA4) 'UA-XXXXXXXX', // Google Universal Analytics (GA3) 'AW-XXXXXXXX', // Google Ads - 'DC-XXXXXXXX' // Floodlight + 'DC-XXXXXXXX', // Floodlight ], }; @@ -93,7 +93,7 @@ Install the plugin and configure the track id. ``` -Configure by `data-ga`. +Configure by `data-ga`, only support single gtag. ```html diff --git a/src/plugins/ga.js b/src/plugins/ga.js index 4b24a24d8..5635cb58d 100644 --- a/src/plugins/ga.js +++ b/src/plugins/ga.js @@ -1,6 +1,9 @@ /* eslint-disable no-console */ // From https://github.com/egoist/vue-ga/blob/master/src/index.js +// prefix of global site tag +const GLOBAL_SITE_TAG_PREFIX = 'G-'; + function appendScript(id) { const script = document.createElement('script'); script.async = true; @@ -9,7 +12,7 @@ function appendScript(id) { } // global site tag instance initialized -function initGlobalSiteTag(id){ +function initGlobalSiteTag(id) { appendScript(id); window.dataLayer = window.dataLayer || []; @@ -25,22 +28,30 @@ function initGlobalSiteTag(id){ // add additional products to your tag // https://developers.google.com/tag-platform/gtagjs/install -function initAdditionalTag(id){ +function initAdditionalTag(id) { window.gtag('config', id); } function init(ids) { - if (Array.isArray(ids)){ - - // the first id must be a global site tag id - initGlobalSiteTag(ids[0]); + if (Array.isArray(ids)) { + // default get the first id + let globalSiteTag = ids[0]; + let globalSiteTagArr = ids.filter( + id => id.indexOf(GLOBAL_SITE_TAG_PREFIX) === 0 + ); + if (globalSiteTagArr.length !== 0) { + globalSiteTag = globalSiteTagArr[0]; + } + + // initialized global site tag id + initGlobalSiteTag(globalSiteTag); // the rest ids - ids.forEach((id, index)=>{ - if (index > 0){ + ids + .filter(id => id !== globalSiteTag) + .forEach((id, index) => { initAdditionalTag(id); - } - }) + }); } else { initGlobalSiteTag(ids); } @@ -68,4 +79,4 @@ const install = function (hook) { hook.beforeEach(collect); }; -$docsify.plugins = [].concat(install, $docsify.plugins); \ No newline at end of file +$docsify.plugins = [].concat(install, $docsify.plugins); From 34105800669dd86b97512d587c23315cf725bcaa Mon Sep 17 00:00:00 2001 From: Eko Zhan Date: Wed, 25 May 2022 19:29:33 +0800 Subject: [PATCH 7/9] feat: add google universal analytics gtag.js plugin --- test/e2e/ga.test.js | 96 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 test/e2e/ga.test.js diff --git a/test/e2e/ga.test.js b/test/e2e/ga.test.js new file mode 100644 index 000000000..c54716123 --- /dev/null +++ b/test/e2e/ga.test.js @@ -0,0 +1,96 @@ +// Modules, constants, and variables +// ----------------------------------------------------------------------------- +const docsifyInit = require('../helpers/docsify-init'); +const { test, expect } = require('./fixtures/docsify-init-fixture'); + +const gaTagList = [ + 'AW-YYYYYY', // Google Ads + 'DC-ZZZZZZ', // Floodlight + 'G-XXXXXX', // Google Analytics 4 (GA4) + 'UA-XXXXXX', // Google Universal Analytics (GA3) +]; + +// Suite +// ----------------------------------------------------------------------------- +test.describe('GA Plugin Tests', () => { + // page request listened, print collect url + function pageRequestListened(page) { + // page.on('request', request => { + // if (request.url().indexOf('www.google-analytics.com') !== -1) { + // console.log(request.url()); + // } + // }); + + page.on('response', response => { + const request = response.request(); + // googleads.g.doubleclick.net + // www.google-analytics.com + // www.googletagmanager.com + const reg = + /googleads\.g\.doubleclick\.net|www\.google-analytics\.com|www\.googletagmanager\.com/g; + if (request.url().match(reg)) { + console.log(request.url(), response.status()); + } + }); + } + + // Tests + // --------------------------------------------------------------------------- + test('single gtag', async ({ page }) => { + pageRequestListened(page); + + const docsifyInitConfig = { + config: { + ga: gaTagList[0], + }, + scriptURLs: ['/lib/plugins/ga.min.js'], + styleURLs: ['/lib/themes/vue.css'], + }; + + await docsifyInit({ + ...docsifyInitConfig, + }); + + const $docsify = await page.evaluate(() => window.$docsify); + + // Verify config options + expect(typeof $docsify).toEqual('object'); + + console.log($docsify.ga, $docsify.ga === ''); + + // Tests + expect($docsify.ga).not.toEqual(''); + }); + + test('multi gtag', async ({ page }) => { + pageRequestListened(page); + + const docsifyInitConfig = { + config: { + ga: gaTagList, + }, + scriptURLs: ['/lib/plugins/ga.min.js'], + styleURLs: ['/lib/themes/vue.css'], + }; + + await docsifyInit({ + ...docsifyInitConfig, + }); + + const $docsify = await page.evaluate(() => window.$docsify); + + // Verify config options + expect(typeof $docsify).toEqual('object'); + + console.log($docsify.ga, $docsify.ga === ''); + + // Tests + expect($docsify.ga).not.toEqual(''); + }); + + test('data-ga attribute', async ({ page }) => { + pageRequestListened(page); + + // TODO + }); +}); From 456f844d4778e05dadee5f4f41827ecd9ccc5a3c Mon Sep 17 00:00:00 2001 From: Eko Zhan Date: Thu, 2 Jun 2022 13:03:26 +0800 Subject: [PATCH 8/9] feat: add google universal analytics gtag.js plugin --- docs/plugins.md | 3 ++- src/plugins/ga.js | 24 ++++++------------------ test/e2e/ga.test.js | 1 + 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/docs/plugins.md b/docs/plugins.md index 857243794..1c538d049 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -75,11 +75,12 @@ Install the plugin and configure the track id. ```html + + +``` + +Configure by `data-ga`. + + +```html + + +``` + +## Google Analytics 4 (GA4) + +Install the plugin and configure the track id. + +```html + - -``` - -Configure by `data-ga`, only support single gtag. - - -```html - - + ``` ## Emoji diff --git a/src/plugins/ga.js b/src/plugins/ga.js index 8f0e42e22..37167a4dc 100644 --- a/src/plugins/ga.js +++ b/src/plugins/ga.js @@ -1,48 +1,22 @@ /* eslint-disable no-console */ // From https://github.com/egoist/vue-ga/blob/master/src/index.js - -function appendScript(id) { +function appendScript() { const script = document.createElement('script'); script.async = true; - script.src = 'https://www.googletagmanager.com/gtag/js?id=' + id; + script.src = 'https://www.google-analytics.com/analytics.js'; document.body.appendChild(script); } -// global site tag instance initialized -function initGlobalSiteTag(id) { - appendScript(id); - - window.dataLayer = window.dataLayer || []; - window.gtag = - window.gtag || +function init(id) { + appendScript(); + window.ga = + window.ga || function () { - window.dataLayer.push(arguments); + (window.ga.q = window.ga.q || []).push(arguments); }; - window.gtag('js', new Date()); - window.gtag('config', id); -} - -// add additional products to your tag -// https://developers.google.com/tag-platform/gtagjs/install -function initAdditionalTag(id) { - window.gtag('config', id); -} - -function init(ids) { - if (Array.isArray(ids)) { - // set the first id to be a global site tag - initGlobalSiteTag(ids[0]); - - // the rest ids - ids.forEach((id, index) => { - if (index > 0) { - initAdditionalTag(id); - } - }); - } else { - initGlobalSiteTag(ids); - } + window.ga.l = Number(new Date()); + window.ga('create', id, 'auto'); } function collect() { @@ -50,12 +24,8 @@ function collect() { init($docsify.ga); } - // usage: https://developers.google.com/analytics/devguides/collection/gtagjs/pages - window.gtag('event', 'page_view', { - page_title: document.title, - page_location: location.href, - page_path: location.pathname, - }); + window.ga('set', 'page', location.hash); + window.ga('send', 'pageview'); } const install = function (hook) { diff --git a/src/plugins/gtag.js b/src/plugins/gtag.js new file mode 100644 index 000000000..aec713cb7 --- /dev/null +++ b/src/plugins/gtag.js @@ -0,0 +1,72 @@ +/* eslint-disable no-console */ +// From ./ga.js + +function appendScript(id) { + const script = document.createElement('script'); + script.async = true; + script.src = 'https://www.googletagmanager.com/gtag/js?id=' + id; + document.body.appendChild(script); +} + +// global site tag instance initialized +function initGlobalSiteTag(id) { + appendScript(id); + + window.dataLayer = window.dataLayer || []; + window.gtag = + window.gtag || + function () { + window.dataLayer.push(arguments); + }; + + window.gtag('js', new Date()); + window.gtag('config', id); +} + +// add additional products to your tag +// https://developers.google.com/tag-platform/gtagjs/install +function initAdditionalTag(id) { + window.gtag('config', id); +} + +function init(ids) { + if (Array.isArray(ids)) { + // set the first id to be a global site tag + initGlobalSiteTag(ids[0]); + + // the rest ids + ids.forEach((id, index) => { + if (index > 0) { + initAdditionalTag(id); + } + }); + } else { + initGlobalSiteTag(ids); + } +} + +function collect() { + if (!window.gtag) { + init($docsify.gtag); + } + + // usage: https://developers.google.com/analytics/devguides/collection/gtagjs/pages + window.gtag('event', 'page_view', { + /* eslint-disable camelcase */ + page_title: document.title, + page_location: location.href, + page_path: location.pathname, + /* eslint-disable camelcase */ + }); +} + +const install = function (hook) { + if (!$docsify.gtag) { + console.error('[Docsify] gtag is required.'); + return; + } + + hook.beforeEach(collect); +}; + +$docsify.plugins = [].concat(install, $docsify.plugins); diff --git a/test/e2e/ga.test.js b/test/e2e/gtag.test.js similarity index 74% rename from test/e2e/ga.test.js rename to test/e2e/gtag.test.js index c021eaa9f..c3ebbcd18 100644 --- a/test/e2e/ga.test.js +++ b/test/e2e/gtag.test.js @@ -1,10 +1,10 @@ // Modules, constants, and variables -// npm run test:e2e ga.test.js +// npm run test:e2e gtag.test.js // ----------------------------------------------------------------------------- const docsifyInit = require('../helpers/docsify-init'); const { test, expect } = require('./fixtures/docsify-init-fixture'); -const gaTagList = [ +const gtagList = [ 'AW-YYYYYY', // Google Ads 'DC-ZZZZZZ', // Floodlight 'G-XXXXXX', // Google Analytics 4 (GA4) @@ -13,14 +13,14 @@ const gaTagList = [ // Suite // ----------------------------------------------------------------------------- -test.describe('GA Plugin Tests', () => { +test.describe('Gtag Plugin Tests', () => { // page request listened, print collect url function pageRequestListened(page) { - // page.on('request', request => { - // if (request.url().indexOf('www.google-analytics.com') !== -1) { - // console.log(request.url()); - // } - // }); + page.on('request', request => { + if (request.url().indexOf('www.google-analytics.com') !== -1) { + // console.log(request.url()); + } + }); page.on('response', response => { const request = response.request(); @@ -30,7 +30,7 @@ test.describe('GA Plugin Tests', () => { const reg = /googleads\.g\.doubleclick\.net|www\.google-analytics\.com|www\.googletagmanager\.com/g; if (request.url().match(reg)) { - console.log(request.url(), response.status()); + // console.log(request.url(), response.status()); } }); } @@ -42,9 +42,9 @@ test.describe('GA Plugin Tests', () => { const docsifyInitConfig = { config: { - ga: gaTagList[0], + gtag: gtagList[0], }, - scriptURLs: ['/lib/plugins/ga.min.js'], + scriptURLs: ['/lib/plugins/gtag.min.js'], styleURLs: ['/lib/themes/vue.css'], }; @@ -57,10 +57,10 @@ test.describe('GA Plugin Tests', () => { // Verify config options expect(typeof $docsify).toEqual('object'); - console.log($docsify.ga, $docsify.ga === ''); + // console.log($docsify.gtag, $docsify.gtag === ''); // Tests - expect($docsify.ga).not.toEqual(''); + expect($docsify.gtag).not.toEqual(''); }); test('multi gtag', async ({ page }) => { @@ -68,9 +68,9 @@ test.describe('GA Plugin Tests', () => { const docsifyInitConfig = { config: { - ga: gaTagList, + gtag: gtagList, }, - scriptURLs: ['/lib/plugins/ga.min.js'], + scriptURLs: ['/lib/plugins/gtag.min.js'], styleURLs: ['/lib/themes/vue.css'], }; @@ -83,10 +83,10 @@ test.describe('GA Plugin Tests', () => { // Verify config options expect(typeof $docsify).toEqual('object'); - console.log($docsify.ga, $docsify.ga === ''); + // console.log($docsify.gtag, $docsify.gtag === ''); // Tests - expect($docsify.ga).not.toEqual(''); + expect($docsify.gtag).not.toEqual(''); }); test('data-ga attribute', async ({ page }) => {