-
-
Save tomfuertes/59a73d8fe530885b9dc6 to your computer and use it in GitHub Desktop.
performant pdp layout differences
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* _optimizely_evaluate=force */ | |
$(function () { | |
$('a').each(function () { | |
var $this = $(this); | |
var href = $this.attr('href'); | |
if (/TODO_PDP_REGEX/.test(href)) { // TODO - Replace This with PDP Regex | |
$this.attr('href', href+'?utm_content=different_layout'); | |
} | |
}); | |
}) | |
/* _optimizely_evaluate=safe */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* _optimizely_evaluate=force */ | |
if (!/utm_content=different_layout/.test(location.href)) { // only if we haven't already redirected | |
var _optly={redir:document.createElement("a")}; | |
_optly.redir.href=window.location.pathname+"?utm_content=different_layout"; | |
_optly.cur=window.location.search; | |
if (_optly.cur) {_optly.redir.search=_optly.redir.search ? _optly.cur + "&" + _optly.redir.search.slice(1) : _optly.cur;} | |
window.location.replace(_optly.redir.href); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment