@uniweb/core 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/tracker.js +22 -10
- package/src/uniweb.js +1 -1
package/package.json
CHANGED
package/src/tracker.js
CHANGED
|
@@ -287,6 +287,12 @@ export default class Tracker {
|
|
|
287
287
|
// after construction. Same reason `Uniweb.defaultInsets` is pre-declared.
|
|
288
288
|
this.onGranted = null
|
|
289
289
|
|
|
290
|
+
// Told each new path, after its `page_view`. The runtime's on-demand listener
|
|
291
|
+
// chunk uses it to notice a page the site counts as a conversion, without
|
|
292
|
+
// every site paying for a route subscription. Declared here for the same
|
|
293
|
+
// reason as `onGranted`.
|
|
294
|
+
this.onPage = null
|
|
295
|
+
|
|
290
296
|
if (isBrowser && this.isEnabled()) {
|
|
291
297
|
this.acquisition = captureAcquisition()
|
|
292
298
|
// Minted even when consent is pending: events buffered before the visitor
|
|
@@ -499,21 +505,27 @@ export default class Tracker {
|
|
|
499
505
|
this.currentPath = path
|
|
500
506
|
this.startTimeOnPage()
|
|
501
507
|
|
|
502
|
-
if (!this.arms('page_view')) return
|
|
503
508
|
// Promptly, rather than waiting out the batch window: a page view is the
|
|
504
509
|
// event most likely to be the only one of a short visit.
|
|
505
510
|
//
|
|
506
511
|
// Emitted only when true, like `continues` — absent is the negative, and it
|
|
507
512
|
// keeps every later view the size it already was.
|
|
508
|
-
this.
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
513
|
+
if (this.arms('page_view')) {
|
|
514
|
+
this.enqueue(
|
|
515
|
+
{
|
|
516
|
+
event: 'page_view',
|
|
517
|
+
path,
|
|
518
|
+
...(this.acquisition || {}),
|
|
519
|
+
...(firstOfLoad ? { first_of_load: true } : {})
|
|
520
|
+
},
|
|
521
|
+
true
|
|
522
|
+
)
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// After the view, so what it reports follows the arrival it belongs to. Not
|
|
526
|
+
// behind `page_view`'s selection, for the reason this method's first comment
|
|
527
|
+
// gives: a site can select one without the other.
|
|
528
|
+
this.onPage?.(path)
|
|
517
529
|
}
|
|
518
530
|
|
|
519
531
|
/**
|
package/src/uniweb.js
CHANGED
|
@@ -94,7 +94,7 @@ export default class Uniweb {
|
|
|
94
94
|
// which is not what this class is for; and the guard it bought was never
|
|
95
95
|
// taken up — every reader in the workspace already optional-chains
|
|
96
96
|
// (`block.js`'s `track()`, and the runtime's `usePageView`,
|
|
97
|
-
// `useSectionViews`, `
|
|
97
|
+
// `useSectionViews`, `useDocumentEvents`), so the
|
|
98
98
|
// invariant lived only in the comment. Cost of carrying it: 1,576 gzip in
|
|
99
99
|
// core's chunk, which press, unipress, `@uniweb/api` and every SSR isolate
|
|
100
100
|
// paid for a class they never wire.
|