Created
February 22, 2024 14:01
-
-
Save dansutherland-engineer/aabf843de42c81b866f844f783d62d7e to your computer and use it in GitHub Desktop.
Liquid A/B Test
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
{% assign randomNumber = "now" | date: "%N" | modulo: 100 %} | |
{% if randomNumber > 50 %} | |
{% render 'snippet-B' %} | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
window.dataLayer.push({ | |
'event': 'ABTest', | |
'variant': 'B' | |
}); | |
</script> | |
{% else %} | |
{% render 'snippet-A' %} | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
window.dataLayer.push({ | |
'event': 'ABTest', | |
'variant': 'A' | |
}); | |
</script> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment