Skip to content

Commit 06e7d23

Browse files
committed
Only increase view counter for parent if top of journey page is opened
1 parent 1d9ea47 commit 06e7d23

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/handlebars/journey.handlebars

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ parent: feed
9999
// user has spent time viewing, use intersection observer
100100
{{&use 'statistics'}}
101101
const statistics = new Statistics();
102-
statistics.add('{{journey.slug}}', '{{sign journey.slug}}', 10000);
103-
statistics.schedule('{{journey.slug}}');
102+
if (!document.location.hash) {
103+
statistics.schedule(statistics.add('{{journey.slug}}', '{{sign journey.slug}}', 10000));
104+
}
104105
105106
const observer = new IntersectionObserver(
106107
(entries) => {

src/main/js/statistics.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class Statistics {
44
/** Adds a statistics target with a given delay */
55
add(target, signature, delay) {
66
this.#tasks[target] = { signature, delay, timer : null, completed : false };
7+
return target;
78
}
89

910
/** Schedules the given statistics target */

0 commit comments

Comments
 (0)