Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow usage of this package when there is no window in the environment #35

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/analytics/dataLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import loadScript from '../utils/loadScript.js'

class DataLayer {
constructor() {
if (typeof window === 'undefined') {
return
}

window.dataLayer = window.dataLayer || []
this.campaignDetails = {}
this.userInformation = {}
Expand Down
4 changes: 4 additions & 0 deletions src/app/hybrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class Hybrid {
}

constructor() {
if (typeof window === 'undefined') {
return
}

// Hook this on window so it can be required in multiple packs
window._hybridEventSubscriptions = window._hybridEventSubscriptions || {}

Expand Down
4 changes: 4 additions & 0 deletions src/privacy/privacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import loadScript from '../utils/loadScript.js'

class Privacy {
constructor() {
if (typeof window === 'undefined') {
return
}

window._privacy = window._privacy || []

this.consent = undefined
Expand Down
Loading