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 () => {
1111 return
1212 }
1313
14- const { disableScriptLoader : noScript , ready } = config
14+ const { ready } = config
1515 const filename = config . debug . enabled ? 'analytics_debug' : 'analytics'
1616 const resource = config . customResourceURL || `https://www.google-analytics.com/${ filename } .js`
1717
@@ -26,7 +26,7 @@ export default () => {
2626 promisify ( config . disabled )
2727 ]
2828
29- if ( shouldGaLoad ( ) && ( ! window . ga || ! noScript ) ) {
29+ if ( shouldGaLoad ( ) ) {
3030 queue . push (
3131 loadScript ( resource ) . catch ( ( ) => {
3232 throw new Error (
Original file line number Diff line number Diff line change @@ -54,7 +54,18 @@ export function hasScript () {
5454}
5555
5656export 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 )
5869}
5970
6071export function getTracker ( tracker ) {
You can’t perform that action at this time.
0 commit comments