Comparing version 1.7.1 to 1.7.2
{ | ||
"name": "zmp-ga4", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Nguyễn Hồng Phát", |
@@ -92,14 +92,16 @@ "use strict"; | ||
var handleLocationChange = function () { | ||
var paths = location.pathname.split("/"); | ||
var pagePath = paths.length > 3 ? "/".concat(paths.slice(3).join("/")) : location.pathname; | ||
setTimeout(function () { | ||
_this.trackEvent("page_view", { | ||
page_path: pagePath, | ||
page_params: location.search, | ||
page_title: document.title | ||
}); | ||
if (_this.options.onPageView) { | ||
_this.options.onPageView(pagePath); | ||
} | ||
}, 0); | ||
var match = /\/zapps\/\d+\/?(.*)/.exec(location.pathname); | ||
if (match) { | ||
var pathname_1 = "/".concat(match[1]); | ||
setTimeout(function () { | ||
_this.trackEvent("page_view", { | ||
page_path: pathname_1, | ||
page_params: location.search, | ||
page_title: document.title | ||
}); | ||
if (_this.options.onPageView) { | ||
_this.options.onPageView(pathname_1); | ||
} | ||
}, 0); | ||
} | ||
}; | ||
@@ -106,0 +108,0 @@ handleLocationChange(); |
@@ -28,15 +28,16 @@ export class AdaptiveAnalytics { | ||
const handleLocationChange = () => { | ||
const paths = location.pathname.split("/"); | ||
const pagePath = | ||
paths.length > 3 ? `/${paths.slice(3).join("/")}` : location.pathname; | ||
setTimeout(() => { | ||
this.trackEvent("page_view", { | ||
page_path: pagePath, | ||
page_params: location.search, | ||
page_title: document.title, | ||
}); | ||
if (this.options.onPageView) { | ||
this.options.onPageView(pagePath); | ||
} | ||
}, 0); | ||
const match = /\/zapps\/\d+\/?(.*)/.exec(location.pathname); | ||
if (match) { | ||
const pathname = `/${match[1]}`; | ||
setTimeout(() => { | ||
this.trackEvent("page_view", { | ||
page_path: pathname, | ||
page_params: location.search, | ||
page_title: document.title, | ||
}); | ||
if (this.options.onPageView) { | ||
this.options.onPageView(pathname); | ||
} | ||
}, 0); | ||
} | ||
}; | ||
@@ -43,0 +44,0 @@ handleLocationChange(); |
17942
378