rough-lamp-33182
06/18/2023, 12:21 AMhappy-autumn-40938
06/19/2023, 5:03 PM<script>
tag, which is quite similar to your use case:
https://docs.growthbook.io/guide/google-tag-manager-and-growthbook
That said, for front-end traffic redirection, it can be a bit tricky to do this in an unbiased (statistically valid) way. This is because your control will have no redirection, but your variant(s) will have a front-end redirection "penalty" which may load more slowly or introduce a flakier user experience. I'd caution being careful to minimize the penalty and/or introduce a similar penalty to your control.
To redirect in JS, you could do something like:
var result = gb.run({
key: "my-experiment",
variations: ["control", "variant"],
weights: [0.5, 0.5], // Traffic split between the variations
coverage: 1.0 // What percent of overall traffic to include (0.0 to 1.0)
});
if (result.value === "variant") {
window.location.href = "<https://mysite.org/variant-page>"
}
mammoth-noon-95267
06/20/2023, 7:22 AMresult.value
never changes?Open source platform for stress free deployments, measured impact, and smarter decisions.
Powered by