Page hiding snippet for Google Content Experiments

309 views Asked by At

I am trying to get rid of flickering effect. I am using GTM + Google experiments API code as a GTM tag.

I want to adapt Optimize's page hiding snippet in order to use it with Content Experiments.

https://support.google.com/360suite/optimize/answer/7100284

    <HTML>
<HEAD>
<!-- Page hiding snippet (recommended)  -->
<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{'GTM-XXXXXX':true});</script>

I have pasted Page-Hiding code into site's HTML, but there is still a flickering-effect. Could you help me please to adapt it and understand why it is not working as expected?

0

There are 0 answers