Skip to content

Commit

Permalink
fix: Google Analytics Plugin build error (#893)
Browse files Browse the repository at this point in the history
  • Loading branch information
mAKEkr authored and ulivz committed Oct 5, 2018
1 parent 94658ae commit d7647bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/@vuepress/plugin-google-analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ module.exports = {
### ga

- Type: `string`
- Default: `/i18n/`
- Default: `undefined`

Provide the Google Analytics ID to enable integration.
2 changes: 1 addition & 1 deletion packages/@vuepress/plugin-google-analytics/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

export default ({ router }) => {
// Google analytics integration
if (process.env.NODE_ENV === 'production' && GA_ID) {
if (process.env.NODE_ENV === 'production' && GA_ID && typeof window !== 'undefined') {
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r
i[r] = i[r] || function () {
Expand Down

0 comments on commit d7647bc

Please sign in to comment.