mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #2559 from overleaf/jel-optimize-anti-flicker
Add Google Optimize anti-flicker snippet GitOrigin-RevId: b3414a03e76ca699923a55221613c07fa7044fb3
This commit is contained in:
parent
a9d7c270a3
commit
0a5f7c05a3
1 changed files with 9 additions and 0 deletions
|
@ -42,6 +42,15 @@ html(
|
||||||
if gaOptimize === true && typeof(gaOptimizeId) != "undefined"
|
if gaOptimize === true && typeof(gaOptimizeId) != "undefined"
|
||||||
script(type='text/javascript').
|
script(type='text/javascript').
|
||||||
ga('require', '#{gaOptimizeId}')
|
ga('require', '#{gaOptimizeId}')
|
||||||
|
//- Anti-flicker snippet
|
||||||
|
style(type='text/css') .async-hide { opacity: 0 !important}
|
||||||
|
script(type='text/javascript').
|
||||||
|
(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,
|
||||||
|
{'#{gaOptimizeId}':true});
|
||||||
|
|
||||||
- else
|
- else
|
||||||
script(type='text/javascript').
|
script(type='text/javascript').
|
||||||
window.ga = function() { console.log("would send to GA", arguments) };
|
window.ga = function() { console.log("would send to GA", arguments) };
|
||||||
|
|
Loading…
Reference in a new issue