Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Page visibility bugs #278

Open
wants to merge 80 commits into
base: page-visibility-bugs
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
ba93f77
Merge pull request #177 from googleanalytics/page-visibility-bugs
philipwalton May 23, 2017
0e6af81
Release version 2.3.3
philipwalton May 23, 2017
5af4f28
Remove site search mentions
philipwalton May 30, 2017
2fac034
Update the analytics.js test files
philipwalton Jun 1, 2017
bdbc90a
Increase the visible threshold to reduce flakiness
philipwalton Jun 1, 2017
d3649b4
Add a siteSearchQueryParams config option
philipwalton Jun 1, 2017
9f7359a
Rename siteSearchQueryParams
philipwalton Jun 2, 2017
432629f
Fix closure compiler warnings
philipwalton Jun 2, 2017
a4ac81c
Add new option documentation
philipwalton Jun 2, 2017
5e13e65
Remove missed compat check
philipwalton Jun 2, 2017
3ebc254
Fixed typo
brentmclark Jun 2, 2017
55c6d0e
Fix documentation spelling error
philipwalton Jun 2, 2017
74308ac
Merge pull request #181 from googleanalytics/site-search
philipwalton Jun 2, 2017
b240254
Merge pull request #182 from brentmclark/patch-1
philipwalton Jun 2, 2017
7b354a5
Release version 2.4.0
philipwalton Jun 2, 2017
7e29fb9
Fix outboundLinkTracker bugs in Safari
philipwalton Jun 7, 2017
64d0a5b
Merge pull request #185 from googleanalytics/safari-outbound-link-bugs
philipwalton Jun 7, 2017
eda5cdc
Release version 2.4.1
philipwalton Jun 7, 2017
f53366e
Update clean-url-tracker.md
niaomingjian Nov 14, 2017
0194377
Merge pull request #210 from niaomingjian/master
philipwalton Nov 14, 2017
647b2ae
Fix MaxScrollTracker interactive events docs
kevinjalbert Nov 28, 2017
bdb83de
Merge pull request #211 from kevinjalbert/patch-1
philipwalton Dec 2, 2017
5c5bf40
Missing trailing - in attribute prefix
pscheit Jan 4, 2018
da0f330
Merge pull request #216 from pscheit/patch-1
philipwalton Jan 4, 2018
19610cb
Fix lint errors from updating google style
philipwalton Feb 8, 2018
14d90da
Add an initial IdleQueue implementation
philipwalton Aug 6, 2018
dece7be
Update dependencies
philipwalton Aug 5, 2018
5ba09e2
Update the gulpfile to work with Gulp 4
philipwalton Aug 5, 2018
8a7cb87
Upgrade test libs and move them out of the bundle
philipwalton Aug 6, 2018
bdb833f
Update .eslintrc to use Google JS style
philipwalton Aug 6, 2018
d448229
Remove unused getEventCount method
philipwalton Aug 6, 2018
5bcc8cb
Optimize the MethodChain.remove static method
philipwalton Aug 6, 2018
4a8b9ad
Add timestamp support to Store
philipwalton Aug 7, 2018
15650a0
Ensure queue callbacks are removed on destroy
philipwalton Aug 9, 2018
41eabdc
Remove tracker logic from IdleQueue
philipwalton Aug 11, 2018
336830e
Simplify Idle and Tracker queue method names
philipwalton Aug 11, 2018
3906b78
Add an isProcessing flag and simplify logic
philipwalton Aug 13, 2018
daaab2a
Clean up tests and use sandbox
philipwalton Aug 13, 2018
7dc9750
Remove tracker method overrides
philipwalton Aug 13, 2018
d602537
Defer expensive initializing until accessed
philipwalton Aug 13, 2018
8b1e6c4
Add missing jsdoc comment
philipwalton Aug 14, 2018
b2bc274
Add a defineIdleProperties utility method
philipwalton Aug 14, 2018
9edd84b
Move shared test helpers into their own file
philipwalton Aug 15, 2018
bbb00ee
Add tests for defineIdleProperties
philipwalton Aug 15, 2018
8fde15d
Refactor defineIdleProperties into IdleValue
philipwalton Aug 17, 2018
90d6764
Update Session and Store to use IdleValue
philipwalton Aug 17, 2018
ed2b306
Fix closure compiler warnings
philipwalton Aug 17, 2018
8b813ec
Add proper reference counting
philipwalton Aug 17, 2018
3eefed4
Update pageVisibilityTracker to use TrackerQueue
philipwalton Aug 17, 2018
e613e54
Update maxScrollTracker to use TrackerQueue
philipwalton Aug 17, 2018
be29604
Update eventTracker to use TrackerQueue
philipwalton Aug 17, 2018
b75615a
Update impressionTracker to use TrackerQueue
philipwalton Aug 17, 2018
220bd71
Update mediaQueryTracker to use TrackerQueue
philipwalton Aug 18, 2018
ed04094
Update socialWidgetTracker to use TrackerQueue
philipwalton Aug 18, 2018
79aad71
Update urlChangeTracker to use TrackerQueue
philipwalton Aug 18, 2018
9f732db
Use the now() utility instead of Date.now()
philipwalton Aug 18, 2018
e9ac57d
Remove the local analytics.js test files
philipwalton Aug 18, 2018
9c8bb0e
Update the build script
philipwalton Aug 18, 2018
34e8cb8
Update gulpfile for the updated build
philipwalton Aug 18, 2018
4dd98c9
Remove unused deferUntilPluginsLoaded utility
philipwalton Aug 19, 2018
e571ba5
Get unit tests passing on Sauce Labs
philipwalton Aug 19, 2018
190af58
Get e2e tests passing on Sauce Labs
philipwalton Aug 19, 2018
278131e
Update travis to run the latest node
philipwalton Aug 19, 2018
6d55c73
Fix SVG link test failures in Safari
philipwalton Aug 19, 2018
1f795ca
Fix regressions caught by tests
philipwalton Aug 20, 2018
15cb392
Fix flakey test
philipwalton Aug 20, 2018
394e01e
Update easy-sauce browsers
philipwalton Aug 20, 2018
2f18a38
Update TrackerQueue to take a tracking ID
philipwalton Aug 21, 2018
8bd569f
Update IdleQueue with yield thresholds
philipwalton Aug 23, 2018
bf05e37
Disable Safari tests while they're flaky
philipwalton Aug 23, 2018
104afcd
Fix store write race conditions
philipwalton Sep 5, 2018
30beb34
Ensure unobserving doesn't error before observing
philipwalton Sep 5, 2018
e738bcc
Add unit test TODOs
philipwalton Sep 5, 2018
863acbb
Add a getState method
philipwalton Sep 6, 2018
703ee09
Update to use idlize
philipwalton Sep 20, 2018
99f7c61
Merge pull request #235 from googleanalytics/idle-callback
philipwalton Sep 20, 2018
74a4b5b
Move idlize from devDependencies to dependencies
philipwalton Sep 22, 2018
b031685
update URLS in README to HTTPS
coliff Oct 9, 2019
405bc44
Merge pull request #250 from coliff/patch-1
philipwalton Oct 9, 2019
646e079
Update README.md
diminishedprime Sep 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update urlChangeTracker to use TrackerQueue
  • Loading branch information
philipwalton committed Aug 18, 2018
commit 79aad71aa5803aa8ad4ba377e09d19a9f377d1c3
17 changes: 12 additions & 5 deletions lib/plugins/url-change-tracker.js
Original file line number Diff line number Diff line change
@@ -17,8 +17,9 @@

import MethodChain from '../method-chain';
import provide from '../provide';
import TrackerQueue from '../tracker-queue';
import {plugins, trackUsage} from '../usage';
import {assign, createFieldsObj} from '../utilities';
import {assign, createFieldsObj, now} from '../utilities';


/**
@@ -54,6 +55,8 @@ class UrlChangeTracker {
// from the location field.
this.path = getPath();

this.queue = TrackerQueue.getOrCreate(tracker);

// Binds methods.
this.pushStateOverride = this.pushStateOverride.bind(this);
this.replaceStateOverride = this.replaceStateOverride.bind(this);
@@ -107,9 +110,9 @@ class UrlChangeTracker {
* modified via `replaceState()`.
*/
handleUrlChange(historyDidUpdate) {
// Calls the update logic asychronously to help ensure that app logic
// Call the update logic asychronously to help ensure that app logic
// responding to the URL change happens prior to this.
setTimeout(() => {
this.queue.add(({time}) => {
const oldPath = this.path;
const newPath = getPath();

@@ -123,12 +126,15 @@ class UrlChangeTracker {

if (historyDidUpdate || this.opts.trackReplaceState) {
/** @type {FieldsObj} */
const defaultFields = {transport: 'beacon'};
const defaultFields = {
transport: 'beacon',
queueTime: now() - time,
};
this.tracker.send('pageview', createFieldsObj(defaultFields,
this.opts.fieldsObj, this.tracker, this.opts.hitFilter));
}
}
}, 0);
});
}

/**
@@ -146,6 +152,7 @@ class UrlChangeTracker {
* Removes all event listeners and restores overridden methods.
*/
remove() {
this.queue.destroy();
MethodChain.remove(history, 'pushState', this.pushStateOverride);
MethodChain.remove(history, 'replaceState', this.replaceStateOverride);
window.removeEventListener('popstate', this.handlePopState);