Skip to content

Commit

Permalink
add prodHost and Audiences
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Bogdan committed Jan 16, 2024
1 parent 0766d46 commit 88888df
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion solutions/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export const DEFAULT_COUNTRY = 'au';

export const METADATA_ANAYTICS_TAGS = 'analytics-tags';

const AUDIENCES = {
mobile: () => window.innerWidth < 600,
desktop: () => window.innerWidth >= 600,
// define your custom audiences here as needed
};

window.hlx.plugins.add('rum-conversion', {
load: 'lazy',
url: '../plugins/rum-conversion/src/index.js',
Expand All @@ -37,7 +43,10 @@ window.hlx.plugins.add('rum-conversion', {
window.hlx.plugins.add('experimentation', {
condition: () => getMetadata('experiment'),
options: {
audiences: AUDIENCES,
prodHost: 'bitdefender.com.au/solutions/',
isProd: () => window.location.hostname.endsWith('hlx.page')
|| window.location.hostname === ('localhost'),
},
url: '../plugins/experimentation/src/index.js',
});
Expand Down Expand Up @@ -410,6 +419,7 @@ function getExperimentDetails() {
if (!window.hlx || !window.hlx.experiment) {
return null;
}

const { id: experimentId, selectedVariant: experimentVariant } = window.hlx.experiment;
return { experimentId, experimentVariant };
}
Expand All @@ -419,7 +429,6 @@ function pushPageLoadToDataLayer() {
if (!hostname) {
return;
}

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

0 comments on commit 88888df

Please sign in to comment.