mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
move scripts in body. analytics fix
This commit is contained in:
@@ -29,11 +29,19 @@
|
||||
'&ea=' + encodeURIComponent(options.eventAction) +
|
||||
(options.eventLabel ? '&el=' + encodeURIComponent(options.eventLabel) : '') +
|
||||
(options.eventValue ? '&ev=' + encodeURIComponent(options.eventValue) : '') +
|
||||
(options.page ? '&dp=' + encodeURIComponent(options.page) : '');
|
||||
(options.page ? '&dp=' + cleanPagePath(options.page) : '');
|
||||
}
|
||||
|
||||
function gaTrackPageView(pagePath) {
|
||||
return '&t=pageview&dp=' + encodeURIComponent(pagePath);
|
||||
return '&t=pageview&dp=' + cleanPagePath(pagePath);
|
||||
}
|
||||
|
||||
function cleanPagePath(pagePath) {
|
||||
var paramIndex = pagePath.indexOf('?');
|
||||
if (paramIndex > -1) {
|
||||
pagePath = pagePath.substring(0, paramIndex);
|
||||
}
|
||||
return encodeURIComponent(pagePath)
|
||||
}
|
||||
|
||||
bgPage.bg_appIdService.getAnonymousAppId(function (gaAnonAppId) {
|
||||
@@ -48,6 +56,9 @@
|
||||
if (param1 === 'pageview' && param2) {
|
||||
message += gaTrackPageView(param2);
|
||||
}
|
||||
else if (typeof param1 === 'object' && param1.hitType === 'pageview') {
|
||||
message += gaTrackPageView(param1.page);
|
||||
}
|
||||
else if (param1 === 'event' && param2) {
|
||||
message += gaTrackEvent(param2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user