0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Added new ghost analytics meta tag behind activity alpha flag

refs https://github.com/TryGhost/Team/issues/1063

Member activity is a labs alpha feature which aims at capturing member events for site owner if switched on. The event metadata captures the site page/post where the event originates from, and the post/page id is included as content of new ghost analytics meta tag. The meta tag is only aded on the site if member activity is switched on from labs.
This commit is contained in:
Rishabh 2021-09-20 13:55:21 +05:30
parent 12f59e7ec0
commit 58bdf1e6e5

View file

@ -2,7 +2,7 @@
// Usage: `{{ghost_head}}`
//
// Outputs scripts and other assets at the top of a Ghost theme
const {metaData, escapeExpression, SafeString, logging, settingsCache, config, blogIcon, urlUtils} = require('../services/proxy');
const {metaData, escapeExpression, SafeString, logging, settingsCache, config, blogIcon, urlUtils, labs} = require('../services/proxy');
const _ = require('lodash');
const debug = require('@tryghost/debug')('ghost_head');
const templateStyles = require('./tpl/styles');
@ -176,6 +176,12 @@ module.exports = function ghost_head(options) { // eslint-disable-line camelcase
head.push('<meta name="generator" content="Ghost ' +
escapeExpression(safeVersion) + '" />');
// Ghost analytics tag
if (labs.isSet('membersActivity')) {
const postId = (dataRoot && dataRoot.post) ? dataRoot.post.id : '';
head.push(writeMetaTag('ghost-analytics-id', postId, 'name'));
}
head.push('<link rel="alternate" type="application/rss+xml" title="' +
escapeExpression(meta.site.title) + '" href="' +
escapeExpression(meta.rssUrl) + '" />');