Skip to content

Commit addbc13

Browse files
committed
Make ribbon experiment versionable
1 parent 27fa6d2 commit addbc13

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

_includes/ribbon.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33
<script>
44
(() => {
55

6+
const VARIANT_VERSION = 2;
7+
const STORAGE_KEY = `ribbonVariant_v${VARIANT_VERSION}`;
8+
9+
610
const ribbonVariants = [
711
{ href: '/masterclasses/', text: 'Arrange a Masterclass' },
812
{ href: '/sentinel/', text: 'Sentinel: Your Web-Performance Watchman' },
913
{ href: '/performance-audits/#fix-it-fast', text: 'Suffering? Fix it Fast!' },
14+
{ href: '/newsletter/', text: 'Join the Newsletter' },
15+
{ href: '/supporters/', text: 'Become a Supporter' }
1016
];
1117

1218
const getVariantIndex = () => {
13-
const stored = localStorage.getItem('ribbonVariant');
19+
const stored = localStorage.getItem(STORAGE_KEY);
1420
const len = ribbonVariants.length;
1521

1622
if (stored !== null) {
@@ -21,7 +27,7 @@
2127
}
2228

2329
const i = Math.floor(Math.random() * len);
24-
localStorage.setItem('ribbonVariant', i);
30+
localStorage.setItem(STORAGE_KEY, i);
2531
return i;
2632
};
2733

0 commit comments

Comments
 (0)