Merge pull request #2958 from overleaf/jel-optimize-zotero

Add Optimize variant on Zotero paywall prompt

GitOrigin-RevId: 005cf27d40a367e4617c399023204dacb80af8de
This commit is contained in:
Miguel Serrano 2020-07-09 15:48:28 +02:00 committed by Copybot
parent d8d3ac82e9
commit 1cac5227d6
3 changed files with 16 additions and 9 deletions

View file

@ -766,6 +766,9 @@ const ProjectController = {
}
metrics.inc(metricName)
const enableOptimize =
!!Settings.experimentId && !user.features.zotero
res.render('project/editor', {
title: project.name,
priority_title: true,
@ -822,7 +825,8 @@ const ProjectController = {
allowedImageNames,
gitBridgePublicBaseUrl: Settings.gitBridgePublicBaseUrl,
wsUrl,
showSupport: Features.hasFeature('support')
showSupport: Features.hasFeature('support'),
gaOptimize: enableOptimize
})
timer.done()
}

View file

@ -354,6 +354,7 @@ module.exports = function(webRouter, privateApiRouter, publicApiRouter) {
webRouter.use(function(req, res, next) {
res.locals.ExposedSettings = {
experimentId: Settings.experimentId,
isOverleaf: Settings.overleaf != null,
appName: Settings.appName,
hasSamlBeta: req.session.samlBeta,

View file

@ -43,14 +43,16 @@ html(
script(type='text/javascript').
ga('require', '#{gaOptimizeId}')
ga('send', 'event', 'pageview', document.title.substring(0, 499), window.location.href.substring(0, 499))
//- 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});
if !experimentId
//- Anti-flicker snippet
//- Only run for tests controlled by Optimize editor
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
script(type='text/javascript').