Skip to content

Commit

Permalink
Fix occasional incorrect page_progress parameter being tracked
Browse files Browse the repository at this point in the history
The bug was causing progress update not to be tracked at all.
Due to JS floating points being JS floating points sometimes
the page_progress was >1 which server refused to accept.

Fix makes sure that it's either 1.0 or less.
  • Loading branch information
rootpd committed Feb 17, 2022
1 parent 9ac0d97 commit 22c10ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Beam/resources/assets/js/remplib.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@ class Tracker {
pageProgress() {
const root = remplib.tracker.getRootElement();
const scrollTop = window.pageYOffset || root.scrollTop || document.body.scrollTop || 0;
return (scrollTop + root.clientHeight) / root.scrollHeight;
// floats could generate number slightly higher than 1.0
return Math.min((scrollTop + root.clientHeight) / root.scrollHeight, 1);
}

getRootElement() {
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

### [Beam]

- Fixed retrieval of browser_id in `conversions:aggregate-events` command which leads to more thorough definition of user's conversion path. remp/remp#1049
- Previously some events (mainly pageviews) could have been not matched correctly and missing in the aggregated data.
- Fixed occasional incorrect page_progress parameter being tracked causing progress update not to be tracked at all.
- Due to JS floating points being JS floating points sometimes the page_progress was >1 which server refused to accept.

## [0.30.0] - 2022-02-10

### Project
Expand All @@ -17,8 +24,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixed possibly too broad scope of IOTA requests. remp/remp#1050
- If the articleSelector didn't match any articles, request was made without an `article_id` filter which could cause temporary Elastic unavailability.
- Added option to configure `--step=` of `pageviews:aggregate-articles-views` command to avoid Elasticsearch's _"Trying to create too many buckets"_ error. remp/remp#1050
- Fixed retrieval of browser_id in `conversions:aggregate-events` command which leads to more thorough definition of user's conversion path. remp/remp#1049
- Previously some events (mainly pageviews) could have been not matched correctly and missing in the aggregated data.

### [Campaign]

Expand Down

0 comments on commit 22c10ba

Please sign in to comment.