Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Script improvements

Blue Mouse3742c62f3b5d
diff --git a/src/Lib.ts b/src/Lib.ts
index 716fb135f..233122413 100644
--- a/src/Lib.ts
+++ b/src/Lib.ts
@@ -52,7 +52,7 @@ export interface PageViewsOptions {
}
-const host = 'http://localhost:5000/log'
+const host = 'http://localhost:5005/log'
export class Lib {
private pageData: PageData | null = null
@@ -113,6 +113,8 @@ export class Lib {
this.pageData.path = pg
const data = {
+ pid: this.projectID,
+ ev: 'pageviews',
lc: getLocale(),
tz: getTimezone(),
ref: getRefferer(),
diff --git a/src/utils.ts b/src/utils.ts
index 2bbdbbebc..18f3dc949 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -1,8 +1,8 @@
const ua = navigator.userAgent || ''
-const findInSearch = (exp: RegExp): string | null => {
+const findInSearch = (exp: RegExp): string | undefined => {
const res = location.search.match(exp)
- return res && res[2]
+ return (res && res[2]) || undefined
}
const utmSourceRegex = /[?&](ref|source|utm_source)=([^?&]+)/