Skip to content

Commit 87f8c72

Browse files
authoredMar 13, 2025··
Remove references to previous path as it is no longer required (#12402)
* Remove previousPath * Remove previousPath * getReferrer only requires platform as a param * Reinstate getAtUserId as it was accidentially deleted * Fix tests * Fix tests * Reinstate accidentally deleted variable * Reinstate accidentally deleted variable * Only set virtual referrer on AMP now that previous path has been removed * Resinstate check for document.referrer
1 parent cc4ce85 commit 87f8c72

File tree

17 files changed

+251
-337
lines changed

17 files changed

+251
-337
lines changed
 

‎src/app/components/ATIAnalytics/atiUrl/index.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,7 @@ describe('Reverb', () => {
320320
pageIdentifier: 'pageIdentifier',
321321
pageTitle: 'pageTitle',
322322
platform: 'canonical' as Platforms,
323-
previousPath: '',
324323
producerName: 'producerName',
325-
origin: 'http://localhost',
326324
nationsProducer: '',
327325
statsDestination: 'statsDestination',
328326
timePublished: 'timePublished',

‎src/app/components/ATIAnalytics/atiUrl/index.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@ export const buildATIPageTrackPath = ({
4040
statsDestination,
4141
timePublished,
4242
timeUpdated,
43-
origin,
44-
previousPath,
4543
categoryName,
4644
campaigns,
4745
nationsProducer,
4846
ampExperimentName,
4947
experimentVariant,
5048
}: ATIPageTrackingProps) => {
5149
const href = getHref(platform);
52-
const referrer = getReferrer(platform, origin, previousPath);
50+
const referrer = getReferrer(platform);
5351
const campaignType = getCampaignType();
5452

5553
// on AMP, variable substitutions are used in the value and they cannot be
@@ -269,7 +267,7 @@ export const buildATIPageTrackPath = ({
269267
// the ref param should always be the last param because ATI will interpret it as part of the referrer URL
270268
key: 'ref',
271269
description: 'referrer url',
272-
value: getReferrer(platform, origin, previousPath),
270+
value: getReferrer(platform),
273271
wrap: false,
274272
// disable encoding for this parameter as ati does not appear to support
275273
// decoding of the ref parameter
@@ -431,16 +429,14 @@ export const buildReverbAnalyticsModel = ({
431429
pageIdentifier,
432430
pageTitle,
433431
platform,
434-
previousPath,
435432
producerName,
436-
origin,
437433
nationsProducer,
438434
statsDestination,
439435
timePublished,
440436
timeUpdated,
441437
}: ATIPageTrackingProps) => {
442438
const href = getHref(platform);
443-
const referrer = getReferrer(platform, origin, previousPath);
439+
const referrer = getReferrer(platform);
444440

445441
const aggregatedCampaigns = (Array.isArray(campaigns) ? campaigns : [])
446442
.map(({ campaignName }) => campaignName)

‎src/app/components/ATIAnalytics/params/buildParams/index.test.ts

+30-36
Large diffs are not rendered by default.

‎src/app/components/ATIAnalytics/params/buildParams/index.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ export const buildPageATIParams = ({
77
requestContext,
88
serviceContext,
99
}: ATIDataWithContexts) => {
10-
const { isUK, origin, platform, previousPath, statsDestination } =
11-
requestContext;
10+
const { isUK, platform, statsDestination } = requestContext;
1211
const {
1312
atiAnalyticsAppName,
1413
atiAnalyticsProducerId,
@@ -46,11 +45,9 @@ export const buildPageATIParams = ({
4645
ldpThingLabels,
4746
libraryVersion: LIBRARY_VERSION,
4847
nationsProducer,
49-
origin,
5048
pageIdentifier,
5149
pageTitle,
5250
platform,
53-
previousPath,
5451
producerId: producerId || atiAnalyticsProducerId,
5552
producerName: atiAnalyticsProducerName,
5653
service,

‎src/app/components/ATIAnalytics/params/frontPage/buildParams.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ const requestContext: RequestContextProps = {
1717
platform: 'canonical',
1818
isUK: false,
1919
statsDestination: 'statsDestination',
20-
previousPath: 'previousPath',
21-
origin: 'origin',
2220
};
2321

2422
// @ts-expect-error - only partial data required for testing purposes

‎src/app/components/ATIAnalytics/params/index.test.ts

+19-26
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ import { ATIData, PageData } from '../types';
2424
.fn()
2525
.mockReturnValue('1970-01-01T00:00:00.000Z');
2626

27+
jest
28+
.spyOn(document, 'referrer', 'get')
29+
.mockReturnValue('https://www.example.com');
30+
2731
// @ts-expect-error - only partial data required for testing purposes
2832
const requestContext: RequestContextProps = {
2933
platform: 'canonical',
3034
isUK: false,
3135
statsDestination: 'statsDestination',
32-
previousPath: 'http://www.example.com',
33-
origin: 'origin',
3436
canonicalLink: 'https://www.bbc.com/pidgin/51536047',
3537
};
3638

@@ -166,7 +168,7 @@ describe('ATIAnalytics params', () => {
166168
x3: '[atiAnalyticsAppName]',
167169
x4: '[pcm]',
168170
x5: '[http%3A%2F%2Flocalhost%2F]',
169-
x6: '[originhttp%3A%2F%2Fwww.example.com]',
171+
x6: '[https%3A%2F%2Fwww.example.com]',
170172
x7: '[article]',
171173
x8: '[simorgh]',
172174
x9: '[Aminat%20Yusuf:%20Tips%20to%20pass%20exam%20-%20Overall%20LASU%20best%20graduate%20drop%20update]',
@@ -176,7 +178,7 @@ describe('ATIAnalytics params', () => {
176178
x13: '[Nigeria~Education~Lagos%20state~Women]',
177179
x14: '[3d5d5e30-dd50-4041-96d5-c970b20005b9~6942cb29-9d3f-4c9c-9806-0a0578c286d6~d651d520-a675-4911-8832-1596f257000b~e45cb5f8-3c87-4ebd-ac1c-058e9be22862]',
178180
x17: '[Nigeria~Education~Lagos%20state~Women]',
179-
ref: 'originhttp://www.example.com',
181+
ref: 'https://www.example.com',
180182
};
181183

182184
expect(parsedATIURLParams).toEqual(expectedATIURLParams);
@@ -206,7 +208,7 @@ describe('ATIAnalytics params', () => {
206208
x3: '[atiAnalyticsAppName]',
207209
x4: '[ha]',
208210
x5: '[http%3A%2F%2Flocalhost%2F]',
209-
x6: '[originhttp%3A%2F%2Fwww.example.com]',
211+
x6: '[https%3A%2F%2Fwww.example.com]',
210212
x7: '[article-sfv]',
211213
x8: '[simorgh]',
212214
x9: '[Kalli%20yadda%20ambaliya%20ta%20tagayyara%20wani%20yanki%20na%20Indiya]',
@@ -215,7 +217,7 @@ describe('ATIAnalytics params', () => {
215217
x13: '[Environment~Narendra+Modi~Nature~India~Severe+weather]',
216218
x14: '[0f37fb35-7f9e-4e49-b189-9d7f1d6fb11f~103fc7e4-3a8d-491c-9a75-3c37c299d48f~12e69b92-a7ba-4463-84e0-be107b9805d0~5a08f030-710f-4168-acee-67294a90fc75~9b16a6c2-7c16-42b7-bff7-6549579622e8]',
217219
x17: '[Environment~Narendra+Modi~Nature~India~Severe+weather]',
218-
ref: 'originhttp://www.example.com',
220+
ref: 'https://www.example.com',
219221
});
220222
});
221223

@@ -236,13 +238,15 @@ describe('ATIAnalytics params', () => {
236238
p: 'service.page',
237239
r: '0x0x24x24',
238240
re: '1024x768',
241+
ref: 'https://www.example.com',
239242
hl: '00-00-00',
240243
lng: 'en-US',
241244
x1: '[urn:bbc:cps:00000000-0000-0000-0000-000000000000]',
242245
x2: '[responsive]',
243246
x3: '[atiAnalyticsAppName]',
244247
x4: '[language]',
245248
x5: '[http%3A%2F%2Flocalhost%2F]',
249+
x6: '[https%3A%2F%2Fwww.example.com]',
246250
x7: '[index-home]',
247251
x8: '[simorgh]',
248252
x9: '[title%20-%20brandName]',
@@ -268,15 +272,15 @@ describe('ATIAnalytics params', () => {
268272
p: 'media::mundo.media.media_asset.41174775.page',
269273
r: '0x0x24x24',
270274
re: '1024x768',
271-
ref: 'originhttp://www.example.com',
275+
ref: 'https://www.example.com',
272276
s: '598285',
273277
s2: 'atiAnalyticsProducerId',
274278
x1: '[urn:bbc:cps:4d36f80b-8711-0b4e-8da0-ef76ae8ac470]',
275279
x2: '[responsive]',
276280
x3: '[atiAnalyticsAppName]',
277281
x4: '[es]',
278282
x5: '[http%3A%2F%2Flocalhost%2F]',
279-
x6: '[originhttp%3A%2F%2Fwww.example.com]',
283+
x6: '[https%3A%2F%2Fwww.example.com]',
280284
x7: '[article-media-asset]',
281285
x8: '[simorgh]',
282286
x9: '[¿Qué%20es%20el%20albur%20en%20México%20y%20cómo%20puedes%20saber%20si%20te%20están%20"albureando"?%20-%20BBC%20News%20Mundo]',
@@ -308,15 +312,15 @@ describe('ATIAnalytics params', () => {
308312
p: 'sport::mundo.sport.photo_gallery.36935058.page',
309313
r: '0x0x24x24',
310314
re: '1024x768',
311-
ref: 'originhttp://www.example.com',
315+
ref: 'https://www.example.com',
312316
s: '598285',
313317
s2: 'atiAnalyticsProducerId',
314318
x1: '[urn:bbc:cps:curie:asset:08e22e90-7361-cd47-b586-7cb53fc5a012]',
315319
x2: '[responsive]',
316320
x3: '[atiAnalyticsAppName]',
317321
x4: '[es]',
318322
x5: '[http%3A%2F%2Flocalhost%2F]',
319-
x6: '[originhttp%3A%2F%2Fwww.example.com]',
323+
x6: '[https%3A%2F%2Fwww.example.com]',
320324
x7: '[article-photo-gallery]',
321325
x8: '[simorgh]',
322326
x9: '[Río%202016,%20el%20antes%20y%20el%20ahora:%20cómo%20ha%20cambiado%20la%20ropa%20deportiva%20en%20más%20de%20un%20siglo%20de%20juegos%20olímpicos%20-%20BBC%20News%20Mundo]',
@@ -348,15 +352,15 @@ describe('ATIAnalytics params', () => {
348352
p: 'kyrgyz.page',
349353
r: '0x0x24x24',
350354
re: '1024x768',
351-
ref: 'originhttp://www.example.com',
355+
ref: 'https://www.example.com',
352356
hl: '00-00-00',
353357
lng: 'en-US',
354358
x1: '[urn:bbc:tipo:topic:cm7682qz7v1t]',
355359
x2: '[responsive]',
356360
x3: '[atiAnalyticsAppName]',
357361
x4: '[pcm]',
358362
x5: '[http%3A%2F%2Flocalhost%2F]',
359-
x6: '[originhttp%3A%2F%2Fwww.example.com]',
363+
x6: '[https%3A%2F%2Fwww.example.com]',
360364
x7: '[index-home]',
361365
x8: '[simorgh]',
362366
x9: '[pageTitle]',
@@ -372,8 +376,8 @@ describe('ATIAnalytics params', () => {
372376

373377
const params = Object.fromEntries(new URLSearchParams(atiUrl));
374378

375-
expect(params.x6).toBe('[originhttp%3A%2F%2Fwww.example.com]');
376-
expect(params.ref).toBe('originhttp://www.example.com');
379+
expect(params.x6).toBe('[https%3A%2F%2Fwww.example.com]');
380+
expect(params.ref).toBe('https://www.example.com');
377381
});
378382

379383
it('should have ref parameter as the last parameter, if referrer url exists', () => {
@@ -384,15 +388,14 @@ describe('ATIAnalytics params', () => {
384388
}) as string;
385389
const params = atiUrl.split('&');
386390

387-
expect(params.pop()).toEqual('ref=originhttp://www.example.com');
391+
expect(params.pop()).toEqual('ref=https://www.example.com');
388392
});
389393

390394
it('should not have ref and x6 parameters, if referrer url does not exist', () => {
391395
const atiUrl = buildATIUrl({
392396
requestContext: {
393397
...requestContext,
394398
pageType: ARTICLE_PAGE,
395-
previousPath: '',
396399
},
397400
serviceContext,
398401
atiData: articlePageAnalyticsData,
@@ -472,13 +475,11 @@ describe('ATIAnalytics params', () => {
472475
ldpThingIds:
473476
'3d5d5e30-dd50-4041-96d5-c970b20005b9~6942cb29-9d3f-4c9c-9806-0a0578c286d6~d651d520-a675-4911-8832-1596f257000b~e45cb5f8-3c87-4ebd-ac1c-058e9be22862',
474477
ldpThingLabels: 'Nigeria~Education~Lagos%20state~Women',
475-
origin: 'origin',
476478
pageIdentifier: 'pidgin.articles.crgrx86em6yo.page',
477479
pageTitle:
478480
'Aminat Yusuf: Tips to pass exam - Overall LASU best graduate drop update',
479481
libraryVersion: 'simorgh',
480482
platform: 'canonical',
481-
previousPath: 'http://www.example.com',
482483
producerId: 'atiAnalyticsProducerId',
483484
service: 'pidgin',
484485
statsDestination: 'statsDestination',
@@ -505,13 +506,11 @@ describe('ATIAnalytics params', () => {
505506
ldpThingIds:
506507
'0f37fb35-7f9e-4e49-b189-9d7f1d6fb11f~103fc7e4-3a8d-491c-9a75-3c37c299d48f~12e69b92-a7ba-4463-84e0-be107b9805d0~5a08f030-710f-4168-acee-67294a90fc75~9b16a6c2-7c16-42b7-bff7-6549579622e8',
507508
ldpThingLabels: 'Environment~Narendra+Modi~Nature~India~Severe+weather',
508-
origin: 'origin',
509509
pageIdentifier: 'hausa.articles.c4nrpd0d4nro.page',
510510
pageTitle: 'Kalli yadda ambaliya ta tagayyara wani yanki na Indiya',
511511
libraryVersion: 'simorgh',
512512
nationsProducer: null,
513513
platform: 'canonical',
514-
previousPath: 'http://www.example.com',
515514
producerId: 'atiAnalyticsProducerId',
516515
service: 'pidgin',
517516
statsDestination: 'statsDestination',
@@ -567,12 +566,10 @@ describe('ATIAnalytics params', () => {
567566
ldpThingLabels: 'Politics~Nicaragua~Latin+America',
568567
libraryVersion: 'simorgh',
569568
nationsProducer: undefined,
570-
origin: 'origin',
571569
pageIdentifier: 'media::mundo.media.media_asset.41174775.page',
572570
pageTitle:
573571
'¿Qué es el albur en México y cómo puedes saber si te están "albureando"? - BBC News Mundo',
574572
platform: 'canonical',
575-
previousPath: 'http://www.example.com',
576573
producerId: 'atiAnalyticsProducerId',
577574
service: 'pidgin',
578575
statsDestination: 'statsDestination',
@@ -605,12 +602,10 @@ describe('ATIAnalytics params', () => {
605602
ldpThingLabels: 'Technology',
606603
libraryVersion: 'simorgh',
607604
nationsProducer: undefined,
608-
origin: 'origin',
609605
pageIdentifier: 'sport::mundo.sport.photo_gallery.36935058.page',
610606
pageTitle:
611607
'Río 2016, el antes y el ahora: cómo ha cambiado la ropa deportiva en más de un siglo de juegos olímpicos - BBC News Mundo',
612608
platform: 'canonical',
613-
previousPath: 'http://www.example.com',
614609
producerId: 'atiAnalyticsProducerId',
615610
service: 'pidgin',
616611
statsDestination: 'statsDestination',
@@ -637,11 +632,9 @@ describe('ATIAnalytics params', () => {
637632
ldpThingLabels: undefined,
638633
libraryVersion: 'simorgh',
639634
nationsProducer: undefined,
640-
origin: 'origin',
641635
pageIdentifier: 'kyrgyz.page',
642636
pageTitle: 'pageTitle',
643637
platform: 'canonical',
644-
previousPath: 'http://www.example.com',
645638
producerId: 'atiAnalyticsProducerId',
646639
service: 'pidgin',
647640
statsDestination: 'statsDestination',

‎src/app/components/ATIAnalytics/params/tvRadioPage/buildParams.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ const requestContext: RequestContextProps = {
4040
platform: 'canonical',
4141
isUK: false,
4242
statsDestination: 'statsDestination',
43-
previousPath: 'previousPath',
44-
origin: 'origin',
4543
};
4644

4745
// @ts-expect-error - only partial data required for testing purposes

‎src/app/components/ATIAnalytics/types.ts

-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ export interface ATIPageTrackingProps {
140140
statsDestination?: string;
141141
timePublished?: string | null;
142142
timeUpdated?: string | null;
143-
origin?: string;
144-
previousPath?: string | null;
145143
categoryName?: string | null;
146144
campaigns?: { campaignId?: string; campaignName?: string }[] | null;
147145
nationsProducer?: string | null;

‎src/app/components/ChartbeatAnalytics/index.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ const ChartbeatAnalytics = ({
2121
const { service, brandName, chartbeatDomain } = useContext(ServiceContext);
2222
const { sendCanonicalChartbeatBeacon } = useContext(UserContext);
2323
const { enabled } = useToggle('chartbeatAnalytics');
24-
const { env, isAmp, platform, pageType, previousPath, origin } =
25-
useContext(RequestContext);
24+
const { env, isAmp, platform, pageType } = useContext(RequestContext);
2625
const isAmpAndEnabled = isAmp && enabled;
2726
const isCanonicalAndEnabled = !isAmp && enabled;
2827

@@ -34,8 +33,6 @@ const ChartbeatAnalytics = ({
3433
chartbeatDomain,
3534
env,
3635
service,
37-
origin,
38-
previousPath,
3936
sectionName,
4037
categoryName,
4138
mediaPageType,

‎src/app/components/ChartbeatAnalytics/utils/index.test.ts

+189-224
Large diffs are not rendered by default.

‎src/app/components/ChartbeatAnalytics/utils/index.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ export interface GetConfigProps {
203203
brandName: string;
204204
env: Environments;
205205
service: Services;
206-
origin: string;
207-
previousPath: string | null;
208206
chartbeatDomain: string;
209207
sectionName?: string;
210208
mediaPageType?: string;
@@ -224,8 +222,6 @@ export const getConfig = ({
224222
brandName,
225223
env,
226224
service,
227-
origin,
228-
previousPath,
229225
chartbeatDomain,
230226
mediaPageType,
231227
sectionName,
@@ -237,8 +233,7 @@ export const getConfig = ({
237233
producer,
238234
chapter,
239235
}: GetConfigProps) => {
240-
const referrer =
241-
previousPath || isAmp ? getReferrer(platform, origin, previousPath) : null;
236+
const referrer = isAmp ? getReferrer(platform) : null;
242237

243238
const analyticsTitle = getTitle({
244239
pageType,

‎src/app/contexts/RequestContext/index.test.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const input = {
5656
service: 'service',
5757
statusCode: 200,
5858
pathname: '/current-path',
59-
previousPath: '/previous-path',
6059
variant: 'simp',
6160
showAdsBasedOnLocation: true,
6261
mvtExperiments: [{ experimentName: 'foo', variation: 'bar' }],
@@ -80,7 +79,6 @@ const expectedOutput = {
8079
statsDestination: 'getStatsDestination',
8180
statsPageIdentifier: 'getStatsPageIdentifier',
8281
statusCode: 200,
83-
previousPath: '/previous-path',
8482
canonicalLink: 'canonicalLink',
8583
ampLink: 'ampLink',
8684
canonicalUkLink: 'canonicalUkLink',

‎src/app/contexts/RequestContext/index.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export type RequestContextProps = {
3333
derivedPageType: string | null;
3434
pathname: string;
3535
platform: Platforms;
36-
previousPath: string | null;
3736
service: Services;
3837
showAdsBasedOnLocation: boolean;
3938
showCookieBannerBasedOnCountry: boolean;
@@ -58,7 +57,6 @@ type RequestProviderProps = {
5857
isNextJs?: boolean;
5958
pageType: PageTypes;
6059
pathname: string;
61-
previousPath?: string | null;
6260
service: Services;
6361
showAdsBasedOnLocation?: boolean;
6462
showCookieBannerBasedOnCountry?: boolean;
@@ -81,7 +79,6 @@ export const RequestContextProvider = ({
8179
mvtExperiments = null,
8280
pageType,
8381
pathname,
84-
previousPath = null,
8582
service,
8683
showAdsBasedOnLocation = false,
8784
showCookieBannerBasedOnCountry = true,
@@ -135,7 +132,6 @@ export const RequestContextProvider = ({
135132
statsDestination,
136133
statsPageIdentifier,
137134
statusCode,
138-
previousPath,
139135
variant,
140136
timeOnServer,
141137
showAdsBasedOnLocation,
@@ -159,7 +155,6 @@ export const RequestContextProvider = ({
159155
pageType,
160156
pathname,
161157
platform,
162-
previousPath,
163158
service,
164159
showAdsBasedOnLocation,
165160
showCookieBannerBasedOnCountry,

‎src/app/legacy/containers/PageHandlers/__snapshots__/withContexts.test.jsx.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ exports[`withContexts HOC should return all context providers 1`] = `
66
{"lang":"en-GB","articleAuthor":"https://www.facebook.com/bbcnews","articleTimestampPrefix":"Updated","articleTimestampSuffix":"","atiAnalyticsAppName":"news","atiAnalyticsProducerId":"64","atiAnalyticsProducerName":"NEWS","chartbeatDomain":"bbc.co.uk","brandName":"BBC News","product":"BBC News","defaultImage":"https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/metadata/poster-1024x576.png","defaultImageAltText":"BBC News","dir":"ltr","externalLinkText":", external","imageCaptionOffscreenText":"Image caption, ","videoCaptionOffscreenText":"Video caption, ","audioCaptionOffscreenText":"Audio caption","defaultCaptionOffscreenText":"Caption, ","imageCopyrightOffscreenText":"Image source, ","locale":"en_GB","datetimeLocale":"en-gb","service":"news","serviceName":"News","languageName":"English","twitterCreator":"@BBCNews","twitterSite":"@BBCNews","noBylinesPolicy":"https://www.bbc.com/news/help-41670342#authorexpertise","publishingPrinciples":"https://www.bbc.com/news/help-41670342","isTrustProjectParticipant":true,"script":{"atlas":{"groupA":{"fontSize":78,"lineHeight":84},"groupB":{"fontSize":96,"lineHeight":104},"groupD":{"fontSize":140,"lineHeight":148}},"elephant":{"groupA":{"fontSize":60,"lineHeight":64},"groupB":{"fontSize":78,"lineHeight":84},"groupD":{"fontSize":116,"lineHeight":124}},"imperial":{"groupA":{"fontSize":50,"lineHeight":54},"groupB":{"fontSize":64,"lineHeight":72},"groupD":{"fontSize":96,"lineHeight":104}},"royal":{"groupA":{"fontSize":40,"lineHeight":44},"groupB":{"fontSize":52,"lineHeight":60},"groupD":{"fontSize":76,"lineHeight":84}},"foolscap":{"groupA":{"fontSize":32,"lineHeight":36},"groupB":{"fontSize":40,"lineHeight":44},"groupD":{"fontSize":56,"lineHeight":60}},"canon":{"groupA":{"fontSize":28,"lineHeight":32},"groupB":{"fontSize":32,"lineHeight":36},"groupD":{"fontSize":44,"lineHeight":48}},"trafalgar":{"groupA":{"fontSize":20,"lineHeight":24},"groupB":{"fontSize":24,"lineHeight":28},"groupD":{"fontSize":32,"lineHeight":36}},"paragon":{"groupA":{"fontSize":20,"lineHeight":24},"groupB":{"fontSize":22,"lineHeight":26},"groupD":{"fontSize":28,"lineHeight":32}},"doublePica":{"groupA":{"fontSize":18,"lineHeight":22},"groupB":{"fontSize":20,"lineHeight":24},"groupD":{"fontSize":24,"lineHeight":28}},"greatPrimer":{"groupA":{"fontSize":18,"lineHeight":22},"groupB":{"fontSize":18,"lineHeight":22},"groupD":{"fontSize":20,"lineHeight":24}},"bodyCopy":{"groupA":{"fontSize":15,"lineHeight":20},"groupB":{"fontSize":16,"lineHeight":22},"groupD":{"fontSize":16,"lineHeight":22}},"pica":{"groupA":{"fontSize":15,"lineHeight":20},"groupB":{"fontSize":16,"lineHeight":20},"groupD":{"fontSize":16,"lineHeight":20}},"longPrimer":{"groupA":{"fontSize":15,"lineHeight":18},"groupB":{"fontSize":15,"lineHeight":18},"groupD":{"fontSize":14,"lineHeight":18}},"brevier":{"groupA":{"fontSize":14,"lineHeight":18},"groupB":{"fontSize":14,"lineHeight":18},"groupD":{"fontSize":13,"lineHeight":16}},"minion":{"groupA":{"fontSize":12,"lineHeight":16},"groupB":{"fontSize":12,"lineHeight":16},"groupD":{"fontSize":12,"lineHeight":16}}},"manifestPath":"/articles/manifest.json","frontPageTitle":"Home","showAdPlaceholder":false,"showRelatedTopics":true,"translations":{"ads":{"advertisementLabel":"Advertisement"},"home":"Home","currentPage":"Current page","skipLinkText":"Skip to content","relatedContent":"Related content","relatedTopics":"Related topics","navMenuText":"Sections","mediaAssetPage":{"mediaPlayer":"Media player","audioPlayer":"Audio player","videoPlayer":"Video player"},"liveExperiencePage":{"liveLabel":"Live","liveCoverage":"Live Coverage","breaking":"Breaking","postedAt":"Posted at","summary":"Summary","shareButtonText":"Share"},"downloads":{"instructions":"You can download and view today’s news.","title":"File Download"},"gist":"At a glance","error":{"404":{"statusCode":"404","title":"Page cannot be found","message":"Sorry, we're unable to bring you the page you're looking for. Please try:","solutions":["Double checking the url","Hitting the refresh button in your browser","Searching for this page using the BBC search bar"],"callToActionFirst":"Alternatively, please visit the ","callToActionLinkText":"BBC News homepage.","callToActionLast":"","callToActionLinkUrl":"https://www.bbc.com/news"},"500":{"statusCode":"500","title":"Internal server error","message":"Sorry, we're currently unable to bring you the page you're looking for. Please try:","solutions":["Hitting the refresh button in your browser","Coming back again later"],"callToActionFirst":"Alternatively, please visit the ","callToActionLinkText":"BBC News homepage.","callToActionLast":"","callToActionLinkUrl":"https://www.bbc.com/news"}},"consentBanner":{"privacy":{"title":"We've updated our Privacy and Cookies Policy","description":{"uk":{"first":"We've made some important changes to our Privacy and Cookies Policy and we want you to know what this means for you and your data.","linkText":null,"last":null,"linkUrl":null},"international":{"first":"We've made some important changes to our Privacy and Cookies Policy and we want you to know what this means for you and your data.","linkText":null,"last":null,"linkUrl":null}},"accept":"OK","reject":"Find out what's changed","rejectUrl":"https://www.bbc.co.uk/usingthebbc/privacy-policy/"},"cookie":{"amp":{"accept":"Accept data collection and continue","reject":"Reject data collection and continue","initial":{"title":"Let us know you agree to data collection on AMP","description":{"first":"We and our partners use technologies, such as ","linkText":"cookies","last":", and collect browsing data to give you the best online experience and to personalise the content and advertising shown to you. Please let us know if you agree.","linkUrl":"https://www.bbc.co.uk/usingthebbc/cookies/what-do-i-need-to-know-about-cookies/"},"manage":"Manage my settings"},"manage":{"title":"Manage consent settings on AMP pages","description":{"para1":"These settings apply to AMP pages only. You may be asked to set these preferences again when you visit non-AMP BBC pages.","para2":"The lightweight mobile page you have visited has been built using Google AMP technology.","heading2":"Strictly necessary data collection","para3":"To make our web pages work, we store some limited information on your device without your consent.","para4":{"text":"Read more about the essential information we store on your device to make our web pages work.","url":"https://www.bbc.co.uk/usingthebbc/strictly-necessary-cookies/"},"para5":"We use local storage to store your consent preferences on your device.","heading3":"Optional data collection","para6":"When you consent to data collection on AMP pages you are consenting to allow us to display personalised ads that are relevant to you when you are outside of the UK.","para7":{"text":"Read more about how we personalise ads in the BBC and our advertising partners.","url":"https://www.bbc.com/usingthebbc/cookies/how-does-the-bbc-use-cookies-for-advertising/"},"para8":"You can choose not to receive personalised ads by clicking “Reject data collection and continue” below. Please note that you will still see advertising, but it will not be personalised to you.","para9":"You can change these settings by clicking “Ad Choices / Do not sell my info” in the footer at any time."}}},"canonical":{"title":"Let us know you agree to cookies","description":{"uk":{"first":"We use ","linkText":"cookies","last":" to give you the best online experience. Please let us know if you agree to all of these cookies.","linkUrl":"https://www.bbc.co.uk/usingthebbc/cookies/what-do-i-need-to-know-about-cookies/"},"international":{"first":"We use ","linkText":"cookies","last":" to give you the best online experience. Please let us know if you agree to all of these cookies.","linkUrl":"https://www.bbc.co.uk/usingthebbc/cookies/what-do-i-need-to-know-about-cookies/"}},"accept":"Yes, I agree","reject":"No, take me to settings","rejectUrl":"https://www.bbc.co.uk/usingthebbc/cookies/how-can-i-change-my-bbc-cookie-settings/"}}},"media":{"noJs":"To play this content, please enable JavaScript, or try a different browser","contentExpired":"This content is no longer available","audio":"Audio","photogallery":"Image gallery","video":"Video","listen":"Listen","watch":"Watch","liveLabel":"LIVE","nextLabel":"NEXT","previousRadioShow":"Previous radio show","nextRadioShow":"Next radio show","duration":"Duration"},"socialEmbed":{},"featuresAnalysisTitle":"More to explore"},"mostRead":{"header":"Most read","lastUpdated":"Last updated:","numberOfItems":10,"hasMostRead":true},"radioSchedule":{"hasRadioSchedule":false},"recommendations":{"hasStoryRecommendations":false},"footer":{"trustProjectLink":{"href":"https://www.bbc.com/news/help-41670342","text":"Why you can trust the BBC"},"externalLink":{"href":"https://www.bbc.co.uk/editorialguidelines/guidance/feeds-and-links","text":"Read about our approach to external linking."},"links":[{"href":"https://www.bbc.com/terms","text":"Terms of Use"},{"href":"https://www.bbc.co.uk/aboutthebbc/","text":"About the BBC"},{"href":"https://www.bbc.com/privacy/","text":"Privacy Policy"},{"href":"https://www.bbc.com/usingthebbc/cookies/","text":"Cookies"},{"href":"https://www.bbc.com/accessibility/","text":"Accessibility Help"},{"href":"https://www.bbc.com/contact/","text":"Contact the BBC"},{"id":"COOKIE_SETTINGS","href":"#","text":"Do not share or sell my info","lang":"en-GB"}],"copyrightText":"BBC. The BBC is not responsible for the content of external sites."},"timezone":"Europe/London","navigation":[{"title":"Home","url":"/news"},{"title":"UK","url":"/news/uk"},{"title":"World","url":"/news/world"},{"title":"Business","url":"/news/business"},{"title":"Politics","url":"/news/politics"},{"title":"Tech","url":"/news/technology"},{"title":"Science","url":"/news/science_and_environment"},{"title":"Health","url":"/news/health"},{"title":"Family & Education","url":"/news/education"},{"title":"Entertainment & Arts","url":"/news/entertainment_and_arts"},{"title":"Stories","url":"/news/stories"}]}
77
</span>
88
<span>
9-
{"env":"live","id":"c0000000000o","isUK":true,"origin":"https://www.bbc.com","pageType":"article","derivedPageType":null,"isAmp":true,"isApp":false,"isLite":false,"isNextJs":false,"platform":"amp","statsDestination":"NEWS_PS_TEST","statsPageIdentifier":"news.articles.c0000000000o.page","statusCode":200,"previousPath":null,"variant":null,"timeOnServer":null,"showAdsBasedOnLocation":true,"showCookieBannerBasedOnCountry":true,"service":"news","pathname":"/pathname","canonicalLink":"https://www.bbc.com/pathname","ampLink":"https://www.bbc.com/pathname.amp","canonicalUkLink":"https://www.bbc.co.uk/pathname","ampUkLink":"https://www.bbc.co.uk/pathname.amp","canonicalNonUkLink":"https://www.bbc.com/pathname","ampNonUkLink":"https://www.bbc.com/pathname.amp","mvtExperiments":[{"experimentName":"foo","variation":"bar"}]}
9+
{"env":"live","id":"c0000000000o","isUK":true,"origin":"https://www.bbc.com","pageType":"article","derivedPageType":null,"isAmp":true,"isApp":false,"isLite":false,"isNextJs":false,"platform":"amp","statsDestination":"NEWS_PS_TEST","statsPageIdentifier":"news.articles.c0000000000o.page","statusCode":200,"variant":null,"timeOnServer":null,"showAdsBasedOnLocation":true,"showCookieBannerBasedOnCountry":true,"service":"news","pathname":"/pathname","canonicalLink":"https://www.bbc.com/pathname","ampLink":"https://www.bbc.com/pathname.amp","canonicalUkLink":"https://www.bbc.co.uk/pathname","ampUkLink":"https://www.bbc.co.uk/pathname.amp","canonicalNonUkLink":"https://www.bbc.com/pathname","ampNonUkLink":"https://www.bbc.com/pathname.amp","mvtExperiments":[{"experimentName":"foo","variation":"bar"}]}
1010
</span>
1111
<span>
1212
{"toggleState":{"testToggle":{"enabled":false}},"toggleDispatch":"*function - bound dispatchReducerAction*"}

‎src/app/legacy/containers/PageHandlers/withContexts.jsx

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const WithContexts = Component => {
2121
isLite = false,
2222
pageType,
2323
pathname,
24-
previousPath = null,
2524
variant = null,
2625
timeOnServer = null,
2726
pageData = null,
@@ -52,7 +51,6 @@ const WithContexts = Component => {
5251
service={service}
5352
statusCode={status}
5453
pathname={pathname}
55-
previousPath={previousPath}
5654
variant={variant}
5755
timeOnServer={timeOnServer}
5856
showAdsBasedOnLocation={showAdsBasedOnLocation}

‎src/app/lib/analyticsUtils/index.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import Cookie from 'js-cookie';
22
import pathOr from 'ramda/src/pathOr';
33
import path from 'ramda/src/path';
44
import Url from 'url-parse';
5-
import onClient from '../utilities/onClient';
6-
import getUUID from '../utilities/getUUID';
7-
import isOperaProxy from '../utilities/isOperaProxy';
5+
import onClient from '#lib/utilities/onClient';
6+
import getUUID from '#lib/utilities/getUUID';
7+
import isOperaProxy from '#lib/utilities/isOperaProxy';
88
import {
99
MEDIUM_CAMPAIGN_IDENTIFIER,
1010
XTOR_CAMPAIGN_IDENTIFIER,
@@ -176,7 +176,7 @@ export const getHref = platform => {
176176
return null;
177177
};
178178

179-
export const getReferrer = (platform, origin, previousPath) => {
179+
export const getReferrer = platform => {
180180
if (platform === 'amp') {
181181
/* On AMP, `\${documentReferrer}` is an amp analytics variable that resolves
182182
to a `document.referrer` equivalent as the window document is undefined on amp pages.
@@ -185,11 +185,8 @@ export const getReferrer = (platform, origin, previousPath) => {
185185
return `\${documentReferrer}`;
186186
}
187187

188-
if (onClient() && (document.referrer || previousPath)) {
189-
const referrer = previousPath
190-
? `${origin}${previousPath}`
191-
: document.referrer;
192-
return referrer;
188+
if (onClient() && document.referrer) {
189+
return document.referrer;
193190
}
194191

195192
return null;

‎ws-nextjs-app/pages/_app.page.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ interface Props extends AppProps {
3636
pageLang?: string;
3737
pageType: PageTypes;
3838
pathname: string;
39-
previousPath?: string;
4039
service: Services;
4140
showAdsBasedOnLocation: boolean;
4241
status: number;
@@ -61,7 +60,6 @@ export default function App({ Component, pageProps }: Props) {
6160
pageLang = '',
6261
pageType,
6362
pathname,
64-
previousPath = '',
6563
service,
6664
showAdsBasedOnLocation,
6765
status,
@@ -97,7 +95,6 @@ export default function App({ Component, pageProps }: Props) {
9795
service={service}
9896
statusCode={status}
9997
pathname={pathname}
100-
previousPath={previousPath}
10198
variant={variant}
10299
timeOnServer={timeOnServer}
103100
showAdsBasedOnLocation={showAdsBasedOnLocation}

0 commit comments

Comments
 (0)
Please sign in to comment.