Skip to content

Commit 32a7f53

Browse files
authored
Removed trafficAnalyticsTracking flag (#24244)
ref https://ghost.slack.com/archives/C07HTEJMR2R/p1751456423072209 This is no longer in use.
1 parent 2f57da8 commit 32a7f53

File tree

5 files changed

+57
-50
lines changed

5 files changed

+57
-50
lines changed

ghost/core/core/frontend/helpers/ghost_head.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ module.exports = async function ghost_head(options) { // eslint-disable-line cam
362362
if (!_.isEmpty(tagCodeInjection)) {
363363
head.push(tagCodeInjection);
364364
}
365-
const isTbTrackingEnabled = labs.isSet('trafficAnalytics') || labs.isSet('trafficAnalyticsTracking');
365+
const isTbTrackingEnabled = labs.isSet('trafficAnalytics');
366366
const hasTbConfig = config.get('tinybird') && config.get('tinybird:tracker');
367367
if (isTbTrackingEnabled && hasTbConfig) {
368368
head.push(getTinybirdTrackerScript(dataRoot));

ghost/core/core/shared/labs.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const PRIVATE_FEATURES = [
4343
'stripeAutomaticTax',
4444
'webmentions',
4545
'trafficAnalytics',
46-
'trafficAnalyticsTracking',
4746
'importMemberTier',
4847
'urlCache',
4948
'mailEvents',

ghost/core/test/e2e-api/admin/__snapshots__/config.test.js.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Object {
2929
"themeErrorsNotification": true,
3030
"trafficAnalytics": true,
3131
"trafficAnalyticsAlpha": true,
32-
"trafficAnalyticsTracking": true,
3332
"ui60": true,
3433
"urlCache": true,
3534
"webmentions": true,

ghost/core/test/unit/frontend/helpers/__snapshots__/ghost_head.test.js.snap

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2173,6 +2173,58 @@ Object {
21732173
}
21742174
`;
21752175

2176+
exports[`{{ghost_head}} helper includes tinybird tracker script when config is set includes tracker script when trafficAnalytics is set 1 1`] = `
2177+
Object {
2178+
"rendered": "<meta name=\\"description\\" content=\\"site description\\">
2179+
<link rel=\\"canonical\\" href=\\"http://127.0.0.1:2369/\\">
2180+
<meta name=\\"referrer\\" content=\\"no-referrer-when-downgrade\\">
2181+
2182+
<meta property=\\"og:site_name\\" content=\\"Ghost\\">
2183+
<meta property=\\"og:type\\" content=\\"website\\">
2184+
<meta property=\\"og:title\\" content=\\"Ghost\\">
2185+
<meta property=\\"og:description\\" content=\\"site description\\">
2186+
<meta property=\\"og:url\\" content=\\"http://127.0.0.1:2369/\\">
2187+
<meta property=\\"og:image\\" content=\\"http://127.0.0.1:2369/content/images/site-cover.png\\">
2188+
<meta name=\\"twitter:card\\" content=\\"summary_large_image\\">
2189+
<meta name=\\"twitter:title\\" content=\\"Ghost\\">
2190+
<meta name=\\"twitter:description\\" content=\\"site description\\">
2191+
<meta name=\\"twitter:url\\" content=\\"http://127.0.0.1:2369/\\">
2192+
<meta name=\\"twitter:image\\" content=\\"http://127.0.0.1:2369/content/images/site-cover.png\\">
2193+
2194+
<script type=\\"application/ld+json\\">
2195+
{
2196+
\\"@context\\": \\"https://schema.org\\",
2197+
\\"@type\\": \\"WebSite\\",
2198+
\\"publisher\\": {
2199+
\\"@type\\": \\"Organization\\",
2200+
\\"name\\": \\"Ghost\\",
2201+
\\"url\\": \\"http://127.0.0.1:2369/\\",
2202+
\\"logo\\": {
2203+
\\"@type\\": \\"ImageObject\\",
2204+
\\"url\\": \\"http://127.0.0.1:2369/favicon.ico\\"
2205+
}
2206+
},
2207+
\\"url\\": \\"http://127.0.0.1:2369/\\",
2208+
\\"name\\": \\"Ghost\\",
2209+
\\"image\\": {
2210+
\\"@type\\": \\"ImageObject\\",
2211+
\\"url\\": \\"http://127.0.0.1:2369/content/images/site-cover.png\\"
2212+
},
2213+
\\"mainEntityOfPage\\": \\"http://127.0.0.1:2369/\\",
2214+
\\"description\\": \\"site description\\"
2215+
}
2216+
</script>
2217+
2218+
<meta name=\\"generator\\" content=\\"Ghost 4.3\\">
2219+
<link rel=\\"alternate\\" type=\\"application/rss+xml\\" title=\\"Ghost\\" href=\\"http://localhost:65530/rss/\\">
2220+
2221+
<script defer src=\\"https://cdn.jsdelivr.net/ghost/sodo-search@~[[VERSION]]/umd/sodo-search.min.js\\" data-key=\\"xyz\\" data-styles=\\"https://cdn.jsdelivr.net/ghost/sodo-search@~[[VERSION]]/umd/main.css\\" data-sodo-search=\\"http://127.0.0.1:2369/\\" data-locale=\\"en\\" crossorigin=\\"anonymous\\"></script>
2222+
2223+
<link href=\\"http://127.0.0.1:2369/webmentions/receive/\\" rel=\\"webmention\\">
2224+
<script defer src=\\"/public/ghost-stats.min.js?v=asset-hash\\" data-stringify-payload=\\"false\\" data-datasource=\\"analytics_events\\" data-storage=\\"localStorage\\" data-host=\\"https://e.ghost.org/tb/web_analytics\\" data-token=\\"tinybird_token\\" tb_site_uuid=\\"77f09c60-5a34-4b4c-a3f6-e1b1d78f7412\\" tb_post_uuid=\\"undefined\\" tb_post_type=\\"null\\" tb_member_uuid=\\"undefined\\" tb_member_status=\\"undefined\\"></script>",
2225+
}
2226+
`;
2227+
21762228
exports[`{{ghost_head}} helper includes tinybird tracker script when config is set includes tracker script when trafficAnalyticsTracking is set 1 1`] = `
21772229
Object {
21782230
"rendered": "<meta name=\\"description\\" content=\\"site description\\">

ghost/core/test/unit/frontend/helpers/ghost_head.test.js

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,9 +1409,8 @@ describe('{{ghost_head}} helper', function () {
14091409

14101410
describe('includes tinybird tracker script when config is set', function () {
14111411
let labsStub;
1412-
function setAnalyticsFlags({analytics = false, tracking = false} = {}) {
1412+
function setAnalyticsFlags({analytics = false} = {}) {
14131413
labsStub.withArgs('trafficAnalytics').returns(analytics);
1414-
labsStub.withArgs('trafficAnalyticsTracking').returns(tracking);
14151414
}
14161415
beforeEach(function () {
14171416
configUtils.set({
@@ -1430,11 +1429,11 @@ describe('{{ghost_head}} helper', function () {
14301429
}
14311430
});
14321431
labsStub = sinon.stub(labs, 'isSet');
1433-
setAnalyticsFlags({analytics: true, tracking: false});
1432+
setAnalyticsFlags({analytics: true});
14341433
labsStub.withArgs('i18n').returns(true);
14351434
});
14361435

1437-
it('includes tracker script', async function () {
1436+
it('includes tracker script when trafficAnalytics is set', async function () {
14381437
const rendered = await testGhostHead(testUtils.createHbsResponse({
14391438
locals: {
14401439
relativeUrl: '/',
@@ -1447,49 +1446,7 @@ describe('{{ghost_head}} helper', function () {
14471446
});
14481447

14491448
it('does not include tracker script when trafficAnalytics is not set', async function () {
1450-
setAnalyticsFlags({analytics: false, tracking: false});
1451-
1452-
const rendered = await testGhostHead(testUtils.createHbsResponse({
1453-
locals: {
1454-
relativeUrl: '/',
1455-
context: ['home', 'index'],
1456-
safeVersion: '4.3'
1457-
}
1458-
}));
1459-
1460-
rendered.should.not.match(/script defer src="\/public\/ghost-stats\.min\.js/);
1461-
});
1462-
1463-
it('includes tracker script when trafficAnalyticsTracking is set', async function () {
1464-
setAnalyticsFlags({analytics: false, tracking: true});
1465-
1466-
const rendered = await testGhostHead(testUtils.createHbsResponse({
1467-
locals: {
1468-
relativeUrl: '/',
1469-
context: ['home', 'index'],
1470-
safeVersion: '4.3'
1471-
}
1472-
}));
1473-
1474-
rendered.should.match(/script defer src="\/public\/ghost-stats\.min\.js/);
1475-
});
1476-
1477-
it('includes tracker script when both trafficAnalytics and trafficAnalyticsTracking are set', async function () {
1478-
setAnalyticsFlags({analytics: true, tracking: true});
1479-
1480-
const rendered = await testGhostHead(testUtils.createHbsResponse({
1481-
locals: {
1482-
relativeUrl: '/',
1483-
context: ['home', 'index'],
1484-
safeVersion: '4.3'
1485-
}
1486-
}));
1487-
1488-
rendered.should.match(/script defer src="\/public\/ghost-stats\.min\.js/);
1489-
});
1490-
1491-
it('does not include tracker script when neither trafficAnalytics nor trafficAnalyticsTracking is set', async function () {
1492-
setAnalyticsFlags({analytics: false, tracking: false});
1449+
setAnalyticsFlags({analytics: false});
14931450

14941451
const rendered = await testGhostHead(testUtils.createHbsResponse({
14951452
locals: {

0 commit comments

Comments
 (0)