Skip to content

Commit 0394767

Browse files
committed
record component event on bfcache load
1 parent 100ec9d commit 0394767

File tree

3 files changed

+83
-104
lines changed

3 files changed

+83
-104
lines changed

dotcom-rendering/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@guardian/identity-auth": "6.0.1",
4040
"@guardian/identity-auth-frontend": "8.1.0",
4141
"@guardian/libs": "25.3.0",
42-
"@guardian/ophan-tracker-js": "2.3.2",
42+
"@guardian/ophan-tracker-js": "2.6.1",
4343
"@guardian/react-crossword": "6.3.0",
4444
"@guardian/shimport": "1.0.2",
4545
"@guardian/source": "11.3.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)