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

Fix issue with domain is null error #389

Merged
merged 4 commits into from
Oct 3, 2023
Merged
Changes from 3 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 scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ function getDomainInfo(hostname) {

function pushPageLoadToDataLayer() {
const { hostname } = window.location;
if (!hostname) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect the hostname to be not null. Rather main--bitdefender--hlxsites.hlx.page?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case of sidekick, when loading the page, the window.localtion.hostname is an empty string

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack!

return;
}

const { domain, domainPartsCount } = getDomainInfo(hostname);
const languageCountry = getLanguageCountryFromPath(window.location.pathname);
const environment = getEnvironment(hostname, languageCountry.country);
Expand Down