Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v1-staging' into production-staging
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Aug 23, 2022
2 parents bbeb203 + acf6f97 commit 6ebce69
Showing 1 changed file with 64 additions and 69 deletions.
133 changes: 64 additions & 69 deletions integrations/VWO/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,76 +23,71 @@ class VWO {
}

init() {
logger.debug('===In init VWO===');
// support a global loadIntegration option, and hierarchically destination
// specific load option
if (!this.analytics.loadIntegration) {
logger.debug(
'===Analytics loadIntegration option is disabled. Destination SDKs will not be fetched by the SDK===',
);
return;
}
if (!this.analytics.loadOnlyIntegrations.VWO.loadIntegration) {
logger.debug('===[VWO] loadIntegration option is disabled in the integrations object===');
return;
logger.debug("===In init VWO===");
if (this.analytics.loadOnlyIntegrations?.VWO?.loadIntegration) {
const account_id = this.accountId;
const settings_tolerance = this.settingsTolerance;
const library_tolerance = this.libraryTolerance;
const use_existing_jquery = this.useExistingJquery;
const { isSPA } = this;
window._vwo_code = (function () {
let f = false;
const d = document;
return {
use_existing_jquery() {
return use_existing_jquery;
},
library_tolerance() {
return library_tolerance;
},
finish() {
if (!f) {
f = true;
const a = d.getElementById("_vis_opt_path_hides");
if (a) a.parentNode.removeChild(a);
}
},
finished() {
return f;
},
load(a) {
const b = d.createElement("script");
b.src = a;
b.type = "text/javascript";
b.setAttribute("data-loader", LOAD_ORIGIN);
b.innerText;
b.onerror = function () {
_vwo_code.finish();
};
d.getElementsByTagName("head")[0].appendChild(b);
},
init() {
const settings_timer = setTimeout(
"_vwo_code.finish()",
settings_tolerance
);
const a = d.createElement("style");
const b =
"body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}";
const h = d.getElementsByTagName("head")[0];
a.setAttribute("id", "_vis_opt_path_hides");
a.setAttribute("type", "text/css");
if (a.styleSheet) a.styleSheet.cssText = b;
else a.appendChild(d.createTextNode(b));
h.appendChild(a);
this.load(
`//dev.visualwebsiteoptimizer.com/j.php?a=${account_id}&u=${encodeURIComponent(
d.URL
)}&r=${Math.random()}&f=${+isSPA}`
);
return settings_timer;
},
};
})();
window._vwo_settings_timer = window._vwo_code.init();
} else {
logger.debug("===[VWO]loadIntegration flag is disabled===");
}
const account_id = this.accountId;
const settings_tolerance = this.settingsTolerance;
const library_tolerance = this.libraryTolerance;
const use_existing_jquery = this.useExistingJquery;
const { isSPA } = this;
window._vwo_code = (function () {
let f = false;
const d = document;
return {
use_existing_jquery() {
return use_existing_jquery;
},
library_tolerance() {
return library_tolerance;
},
finish() {
if (!f) {
f = true;
const a = d.getElementById('_vis_opt_path_hides');
if (a) a.parentNode.removeChild(a);
}
},
finished() {
return f;
},
load(a) {
const b = d.createElement('script');
b.src = a;
b.type = 'text/javascript';
b.setAttribute('data-loader', LOAD_ORIGIN);
b.innerText;
b.onerror = function () {
_vwo_code.finish();
};
d.getElementsByTagName('head')[0].appendChild(b);
},
init() {
const settings_timer = setTimeout('_vwo_code.finish()', settings_tolerance);
const a = d.createElement('style');
const b =
'body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}';
const h = d.getElementsByTagName('head')[0];
a.setAttribute('id', '_vis_opt_path_hides');
a.setAttribute('type', 'text/css');
if (a.styleSheet) a.styleSheet.cssText = b;
else a.appendChild(d.createTextNode(b));
h.appendChild(a);
this.load(
`//dev.visualwebsiteoptimizer.com/j.php?a=${account_id}&u=${encodeURIComponent(
d.URL,
)}&r=${Math.random()}&f=${+isSPA}`,
);
return settings_timer;
},
};
})();
window._vwo_settings_timer = window._vwo_code.init();
// Send track or iddentify when
if (this.sendExperimentTrack || this.experimentViewedIdentify) {
this.experimentViewed();
Expand Down

0 comments on commit 6ebce69

Please sign in to comment.