Page hiding snippet for Google Content Experiments

拟墨画扇 提交于 2019-12-24 09:59:25

问题


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?

来源:https://stackoverflow.com/questions/48252440/page-hiding-snippet-for-google-content-experiments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!