Skip to content

Commit

Permalink
Revert "Fix: VWO loadintegration option" changes (#618)
Browse files Browse the repository at this point in the history
Revert "Fix: VWO loadintegration option (#614)"

This reverts commit 2adee37.

Co-authored-by: Sai Kumar Battinoju <88789928+saikumarrs@users.noreply.github.com>
  • Loading branch information
yashasvibajpai and saikumarrs authored Aug 23, 2022
1 parent 2adee37 commit acf6f97
Showing 1 changed file with 64 additions and 70 deletions.
134 changes: 64 additions & 70 deletions integrations/VWO/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,77 +20,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 acf6f97

Please sign in to comment.