landing-page-experiments
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -57,3 +57,3 @@ "use strict"; | ||
}, | ||
getExperimentConfig: function (apiKey, experimentName) { | ||
getExperimentConfig: function (apiKey, experimentId) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -78,3 +78,3 @@ var sid, resp; | ||
}, | ||
configName: experimentName, | ||
configName: experimentId, | ||
}), | ||
@@ -100,5 +100,5 @@ })]; | ||
}, | ||
performRedirect: function (apiKey, experimentName) { | ||
performRedirect: function (apiKey, experimentId) { | ||
var _this = this; | ||
this.getExperimentConfig(apiKey, experimentName) | ||
this.getExperimentConfig(apiKey, experimentId) | ||
.then(function (config) { | ||
@@ -117,1 +117,9 @@ var _a; | ||
}; | ||
if (document.currentScript && document.currentScript.src) { | ||
var url = new URL(document.currentScript.src); | ||
var apiKey = url.searchParams.get('apikey'); | ||
var expId = url.searchParams.get('expid'); | ||
if (apiKey && expId) { | ||
StatsigABHelper.performRedirect(apiKey, expId); | ||
} | ||
} |
{ | ||
"name": "landing-page-experiments", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "Statsig helps run landing page experiments by redirecting users to two or more landing pages based on an ABn Test.", | ||
@@ -5,0 +5,0 @@ "jsdelivr": "dist/index.js", |
@@ -23,3 +23,3 @@ window["StatsigABHelper"] = window["StatsigABHelper"] || { | ||
getExperimentConfig: async function(apiKey, experimentName) { | ||
getExperimentConfig: async function(apiKey, experimentId) { | ||
const sid = this.getStableID(); | ||
@@ -39,3 +39,3 @@ const resp = await fetch('https://featuregates.org/v1/get_config', { | ||
}, | ||
configName: experimentName, | ||
configName: experimentId, | ||
}), | ||
@@ -58,4 +58,4 @@ }); | ||
performRedirect: function(apiKey, experimentName) { | ||
this.getExperimentConfig(apiKey, experimentName) | ||
performRedirect: function(apiKey, experimentId) { | ||
this.getExperimentConfig(apiKey, experimentId) | ||
.then(config => { | ||
@@ -72,2 +72,11 @@ const url = config?.value?.page_url; | ||
} | ||
} | ||
if (document.currentScript && document.currentScript.src) { | ||
const url = new URL(document.currentScript.src); | ||
const apiKey = url.searchParams.get('apikey'); | ||
const expId = url.searchParams.get('expid'); | ||
if (apiKey && expId) { | ||
StatsigABHelper.performRedirect(apiKey, expId); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10766
9
243
2