This repository was archived by the owner on Mar 21, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export default () => {
11
11
return
12
12
}
13
13
14
- const { disableScriptLoader : noScript , ready } = config
14
+ const { ready } = config
15
15
const filename = config . debug . enabled ? 'analytics_debug' : 'analytics'
16
16
const resource = config . customResourceURL || `https://www.google-analytics.com/${ filename } .js`
17
17
@@ -26,7 +26,7 @@ export default () => {
26
26
promisify ( config . disabled )
27
27
]
28
28
29
- if ( shouldGaLoad ( ) && ( ! window . ga || ! noScript ) ) {
29
+ if ( shouldGaLoad ( ) ) {
30
30
queue . push (
31
31
loadScript ( resource ) . catch ( ( ) => {
32
32
throw new Error (
Original file line number Diff line number Diff line change @@ -54,7 +54,18 @@ export function hasScript () {
54
54
}
55
55
56
56
export function shouldGaLoad ( ) {
57
- return ! ( config . checkDuplicatedScript && hasScript ( ) )
57
+ const {
58
+ checkDuplicatedScript,
59
+ disableScriptLoader
60
+ } = config
61
+
62
+ const requires = [
63
+ Boolean ( window && window . ga ) ,
64
+ ( checkDuplicatedScript && ! hasScript ( ) ) ,
65
+ ! disableScriptLoader
66
+ ]
67
+
68
+ return requires . some ( Boolean )
58
69
}
59
70
60
71
export function getTracker ( tracker ) {
You can’t perform that action at this time.
0 commit comments