Skip to content

Commit d7647bc

Browse files
mAKEkrulivz
authored andcommitted
fix: Google Analytics Plugin build error (#893)
1 parent 94658ae commit d7647bc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/@vuepress/plugin-google-analytics/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ module.exports = {
1515
### ga
1616

1717
- Type: `string`
18-
- Default: `/i18n/`
18+
- Default: `undefined`
1919

2020
Provide the Google Analytics ID to enable integration.

packages/@vuepress/plugin-google-analytics/inject.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export default ({ router }) => {
44
// Google analytics integration
5-
if (process.env.NODE_ENV === 'production' && GA_ID) {
5+
if (process.env.NODE_ENV === 'production' && GA_ID && typeof window !== 'undefined') {
66
(function (i, s, o, g, r, a, m) {
77
i['GoogleAnalyticsObject'] = r
88
i[r] = i[r] || function () {

0 commit comments

Comments
 (0)