Skip to content

Commit 09496f8

Browse files
authored
Merge pull request #14572 from guardian/record-bfcache-loads
Record bfcache loads via Ophan component events
2 parents 462b055 + bfc1d21 commit 09496f8

File tree

3 files changed

+345
-705
lines changed

3 files changed

+345
-705
lines changed

dotcom-rendering/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
"@guardian/eslint-config-typescript": "9.0.1",
3939
"@guardian/identity-auth": "6.0.1",
4040
"@guardian/identity-auth-frontend": "8.1.0",
41+
"@guardian/ophan-tracker-js": "2.6.1",
4142
"@guardian/libs": "26.0.0",
42-
"@guardian/ophan-tracker-js": "2.3.2",
4343
"@guardian/react-crossword": "6.3.0",
4444
"@guardian/shimport": "1.0.2",
4545
"@guardian/source": "11.3.0",
4646
"@guardian/source-development-kitchen": "18.1.1",
47-
"@guardian/support-dotcom-components": "7.7.0",
47+
"@guardian/support-dotcom-components": "7.8.1",
4848
"@guardian/tsconfig": "0.2.0",
4949
"@playwright/test": "1.52.0",
5050
"@sentry/browser": "10.10.0",

dotcom-rendering/src/client/ophan/recordInitialPageEvents.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { type EditionId } from '../../lib/edition';
22
import type { RenderingTarget } from '../../types/renderingTarget';
3-
import { getOphan, recordExperiences, recordPerformance } from './ophan';
3+
import {
4+
getOphan,
5+
recordExperiences,
6+
recordPerformance,
7+
submitComponentEvent,
8+
} from './ophan';
49

510
const getEditionForOphan = (editionId: EditionId) => {
611
switch (editionId) {
@@ -29,4 +34,20 @@ export const recordInitialPageEvents = async (
2934
void recordPerformance(renderingTarget);
3035
window.removeEventListener('load', load, false);
3136
});
37+
38+
window.addEventListener('pageshow', (event: PageTransitionEvent) => {
39+
if (!event.persisted) {
40+
return;
41+
}
42+
43+
void submitComponentEvent(
44+
{
45+
action: 'VIEW',
46+
component: {
47+
componentType: 'BF_CACHE',
48+
},
49+
},
50+
renderingTarget,
51+
);
52+
});
3253
};

0 commit comments

Comments
 (0)