Skip to content

Commit

Permalink
Update window object initialization in JavaScript code
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilan-riviere committed Mar 15, 2024
1 parent 6705550 commit 9761b6a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
8 changes: 5 additions & 3 deletions src/Steward.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ public function embed(): string

return <<<HTML
<script>
window.appEnv = '$appEnv';
window.appUrl = '$appUrl';
window.appUrlStorage = '$appUrlStorage';
if (typeof window !== 'undefined') {
window.appEnv = '$appEnv';
window.appUrl = '$appUrl';
window.appUrlStorage = '$appUrlStorage';
}
</script>
HTML;
}
Expand Down
14 changes: 8 additions & 6 deletions src/Support/GdprSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ public function embed(): string
return <<<HTML
<!-- GDPR -->
<script>
window.gdprService = '$gdprService';
window.gdprCookieName = '$gdprCookieName';
window.gdprCookieLifetime = '$gdprCookieLifetime';
window.gdrpMatomoEnabled = '$gdrpMatomoEnabled';
window.gdprMatomoUrl = '$gdprMatomoUrl';
window.gdprMatomoSiteId = '$gdprMatomoSiteId';
if (typeof window !== 'undefined') {
window.gdprService = '$gdprService';
window.gdprCookieName = '$gdprCookieName';
window.gdprCookieLifetime = '$gdprCookieLifetime';
window.gdrpMatomoEnabled = '$gdrpMatomoEnabled';
window.gdprMatomoUrl = '$gdprMatomoUrl';
window.gdprMatomoSiteId = '$gdprMatomoSiteId';
}
</script>
<!-- End GDPR -->
HTML;
Expand Down
14 changes: 8 additions & 6 deletions src/Support/ViteDeferSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ public function embed(): string

return <<<HTML
<script>
window.gdprService = '$gdprService';
window.gdprCookieName = '$gdprCookieName';
window.gdprCookieLifetime = '$gdprCookieLifetime';
window.gdrpMatomoEnabled = '$gdrpMatomoEnabled';
window.gdprMatomoUrl = '$gdprMatomoUrl';
window.gdprMatomoSiteId = '$gdprMatomoSiteId';
if (typeof window !== 'undefined') {
window.gdprService = '$gdprService';
window.gdprCookieName = '$gdprCookieName';
window.gdprCookieLifetime = '$gdprCookieLifetime';
window.gdrpMatomoEnabled = '$gdrpMatomoEnabled';
window.gdprMatomoUrl = '$gdprMatomoUrl';
window.gdprMatomoSiteId = '$gdprMatomoSiteId';
}
</script>
HTML;
}
Expand Down

0 comments on commit 9761b6a

Please sign in to comment.