Add seperate analytics config for universal links

This commit is contained in:
poeti8 2019-06-16 14:10:32 +04:30
parent 1cf87f6681
commit db8a4e9db8
4 changed files with 12 additions and 3 deletions

View File

@ -42,6 +42,10 @@ GOOGLE_SAFE_BROWSING_KEY=
# Example: UA-XXXX-XX
GOOGLE_ANALYTICS=
# Google Analytics tracking ID for universal analytics
# This one is used for links
# GOOGLE_ANALYRICS_UNIVERSAL=
# Your email host details to use to send verification emails.
# More info on http://nodemailer.com/
# Mail from example "Kutt <support@kutt.it>". Leave empty to use MAIL_USER

View File

@ -38,6 +38,10 @@ GOOGLE_SAFE_BROWSING_KEY={{GOOGLE_SAFE_BROWSING_KEY}}
# Example: UA-XXXX-XX
GOOGLE_ANALYTICS={{GOOGLE_ANALYTICS}}
# Google Analytics tracking ID for universal analytics
# This one is used for links
GOOGLE_ANALYRICS_UNIVERSAL={{GOOGLE_ANALYRICS_UNIVERSAL}}
# Your email host details to use to send verification emails.
# More info on http://nodemailer.com/
# Mail from example "Kutt <support@kutt.it>". Leave empty to use MAIL_USER

View File

@ -27,7 +27,8 @@ if (hasServerConfig && hasClientConfig) {
RECAPTCHA_SITE_KEY: clientConfig.RECAPTCHA_SITE_KEY,
RECAPTCHA_SECRET_KEY: serverConfig.RECAPTCHA_SECRET_KEY,
GOOGLE_SAFE_BROWSING_KEY: serverConfig.GOOGLE_SAFE_BROWSING_KEY,
GOOGLE_ANALYTICS: serverConfig.GOOGLE_ANALYTICS || clientConfig.GOOGLE_ANALYTICS,
GOOGLE_ANALYTICS: clientConfig.GOOGLE_ANALYTICS_ID,
GOOGLE_ANALYTICS_UNIVERSAL: serverConfig.GOOGLE_ANALYTICS,
MAIL_HOST: serverConfig.MAIL_HOST,
MAIL_PORT: serverConfig.MAIL_PORT,
MAIL_SECURE: serverConfig.MAIL_SECURE,

View File

@ -188,8 +188,8 @@ exports.goToUrl = async (req, res, next) => {
});
}
if (process.env.GOOGLE_ANALYTICS && !isBot) {
const visitor = ua(process.env.GOOGLE_ANALYTICS);
if (process.env.GOOGLE_ANALYTICS_UNIVERSAL && !isBot) {
const visitor = ua(process.env.GOOGLE_ANALYTICS_UNIVERSAL);
visitor
.pageview({
dp: `/${id}`,