Emit a heap event when the paper is completely loaded
@@ -732,6 +732,7 @@ export default class ScholarReader extends React.PureComponent<Props, State> {
this.setState({
areCitationsLoading: true
});
+ const loadingStartTime = performance.now();
const entities = await api.getEntities(this.props.paperId.id);
this.setState({
entities: stateUtils.createRelationalStoreFromArray(entities, "id"),
@@ -753,6 +754,11 @@ export default class ScholarReader extends React.PureComponent<Props, State> {
this.setState({ papers, areCitationsLoading: false });
}
+ if (window.heap) {
+ const loadingTimeMS = Math.round(performance.now() - loadingStartTime);
+ window.heap.track("paper-loaded", { loadingTimeMS });
+ }
+
const userData = await api.getUserLibraryInfo();
if (userData) {
this.setState({ userLibrary: userData.userLibrary });
