@pageviews/tracker 0.2.3 → 0.4.0
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/README.md +1 -5
- package/dist/module/index.cjs +8 -1
- package/dist/module/index.d.ts +1 -1
- package/dist/module/index.mjs +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,8 +138,4 @@ Stops all tracking and resets state. Useful for SPA cleanup or testing. `init()`
|
|
|
138
138
|
|
|
139
139
|
For configuration options, advanced usage, and the script tag installation method, see the full docs:
|
|
140
140
|
|
|
141
|
-
**[pageviews.ai/docs/npm-module-at-pageviewstracker](https://pageviews.ai/docs/npm-module-at-pageviewstracker)**
|
|
142
|
-
|
|
143
|
-
## License
|
|
144
|
-
|
|
145
|
-
MIT
|
|
141
|
+
**[pageviews.ai/docs/npm-module-at-pageviewstracker](https://pageviews.ai/docs/npm-module-at-pageviewstracker)**
|
package/dist/module/index.cjs
CHANGED
|
@@ -36,7 +36,14 @@ function sendBeaconEvent(endpoint, payload, siteId) {
|
|
|
36
36
|
|
|
37
37
|
// src/core/utils.ts
|
|
38
38
|
const ALLOWED_QUERY_PARAMS = new Set([
|
|
39
|
+
// Attribution
|
|
39
40
|
'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'ref',
|
|
41
|
+
// Pagination
|
|
42
|
+
'page', 'p', 'offset', 'limit', 'per_page',
|
|
43
|
+
// Sorting & filtering
|
|
44
|
+
'sort', 'order', 'orderby', 'order_by', 'filter', 'category', 'cat', 'tag', 'type',
|
|
45
|
+
// Content identifiers
|
|
46
|
+
'id', 'v', 'tab', 'view', 'lang', 'locale', 'hl',
|
|
40
47
|
]);
|
|
41
48
|
function sanitizeUrl(url) {
|
|
42
49
|
try {
|
|
@@ -505,7 +512,7 @@ async function init(options) {
|
|
|
505
512
|
throw new Error('pageviews.init() can only be called once');
|
|
506
513
|
initialized = true;
|
|
507
514
|
const ingestEndpoint = (options.endpoint || 'https://data.pageviews.ai') + '/api/event';
|
|
508
|
-
const cfgEndpoint = options.configEndpoint || 'https://
|
|
515
|
+
const cfgEndpoint = options.configEndpoint || 'https://pageviews.ai';
|
|
509
516
|
const cached = getCachedConfig(options.siteId);
|
|
510
517
|
if (cached) {
|
|
511
518
|
startTracking(Object.assign(Object.assign({}, cached), { siteId: options.siteId, endpoint: ingestEndpoint }));
|
package/dist/module/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ interface InitOptions {
|
|
|
34
34
|
siteId: string;
|
|
35
35
|
/** Ingest service base URL for sending events. Default: https://data.pageviews.ai */
|
|
36
36
|
endpoint?: string;
|
|
37
|
-
/** Laravel app base URL for fetching site config. Default: https://
|
|
37
|
+
/** Laravel app base URL for fetching site config. Default: https://pageviews.ai */
|
|
38
38
|
configEndpoint?: string;
|
|
39
39
|
}
|
|
40
40
|
declare function init(options: InitOptions): Promise<void>;
|
package/dist/module/index.mjs
CHANGED
|
@@ -34,7 +34,14 @@ function sendBeaconEvent(endpoint, payload, siteId) {
|
|
|
34
34
|
|
|
35
35
|
// src/core/utils.ts
|
|
36
36
|
const ALLOWED_QUERY_PARAMS = new Set([
|
|
37
|
+
// Attribution
|
|
37
38
|
'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'ref',
|
|
39
|
+
// Pagination
|
|
40
|
+
'page', 'p', 'offset', 'limit', 'per_page',
|
|
41
|
+
// Sorting & filtering
|
|
42
|
+
'sort', 'order', 'orderby', 'order_by', 'filter', 'category', 'cat', 'tag', 'type',
|
|
43
|
+
// Content identifiers
|
|
44
|
+
'id', 'v', 'tab', 'view', 'lang', 'locale', 'hl',
|
|
38
45
|
]);
|
|
39
46
|
function sanitizeUrl(url) {
|
|
40
47
|
try {
|
|
@@ -503,7 +510,7 @@ async function init(options) {
|
|
|
503
510
|
throw new Error('pageviews.init() can only be called once');
|
|
504
511
|
initialized = true;
|
|
505
512
|
const ingestEndpoint = (options.endpoint || 'https://data.pageviews.ai') + '/api/event';
|
|
506
|
-
const cfgEndpoint = options.configEndpoint || 'https://
|
|
513
|
+
const cfgEndpoint = options.configEndpoint || 'https://pageviews.ai';
|
|
507
514
|
const cached = getCachedConfig(options.siteId);
|
|
508
515
|
if (cached) {
|
|
509
516
|
startTracking(Object.assign(Object.assign({}, cached), { siteId: options.siteId, endpoint: ingestEndpoint }));
|
package/package.json
CHANGED