mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #5442 from overleaf/ta-ga-v4
Add Google Analytics V4 Tags GitOrigin-RevId: 8841bd6a902efa15399b1a219ff7740635898fa1
This commit is contained in:
parent
735f79ab6a
commit
9278ce6cc0
3 changed files with 21 additions and 0 deletions
|
@ -280,6 +280,10 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
|
|||
webRouter.use(function (req, res, next) {
|
||||
res.locals.gaToken =
|
||||
Settings.analytics && Settings.analytics.ga && Settings.analytics.ga.token
|
||||
res.locals.gaTokenV4 =
|
||||
Settings.analytics &&
|
||||
Settings.analytics.ga &&
|
||||
Settings.analytics.ga.tokenV4
|
||||
res.locals.gaOptimizeId = _.get(Settings, ['analytics', 'gaOptimize', 'id'])
|
||||
next()
|
||||
})
|
||||
|
|
|
@ -71,6 +71,14 @@ html(
|
|||
script(type="text/javascript", nonce=scriptNonce).
|
||||
window.ga = function() { console.log("would send to GA", arguments) };
|
||||
|
||||
if (typeof(gaTokenV4) != "undefined")
|
||||
script(async, nonce=scriptNonce, src='https://www.googletagmanager.com/gtag/js?id=' + gaTokenV4)
|
||||
script(type="text/javascript", nonce=scriptNonce).
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', '#{gaTokenV4}');
|
||||
|
||||
block meta
|
||||
meta(name="ol-csrfToken" content=csrfToken)
|
||||
//- Configure dynamically loaded assets (via webpack) to be downloaded from CDN
|
||||
|
|
|
@ -68,6 +68,15 @@ html(
|
|||
script(type="text/javascript", nonce=scriptNonce).
|
||||
window.ga = function() { console.log("would send to GA", arguments) };
|
||||
|
||||
if (typeof(gaTokenV4) != "undefined")
|
||||
script(async, nonce=scriptNonce, src='https://www.googletagmanager.com/gtag/js?id=' + gaTokenV4)
|
||||
script(type="text/javascript", nonce=scriptNonce).
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '#{gaTokenV4}');
|
||||
|
||||
block meta
|
||||
meta(name="ol-csrfToken" content=csrfToken)
|
||||
//- Configure dynamically loaded assets (via webpack) to be downloaded from CDN
|
||||
|
|
Loading…
Reference in a new issue