This ensures that the element only appears for the intended users without unnecessary layout shifts.
<div id="testElement" style="display: none;">AB Test Content</div>
<script>
if (shouldShowElement) { // AB testing condition
document.getElementById("testElement").style.display = "block";
}
</script>