Merge pull request #4228 from manuelfesantos/feat/auto-pageview-attribute
feat: add data-auto-pageview attribute to tracker script
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
const domain = config('domains') || '';
|
const domain = config('domains') || '';
|
||||||
const credentials = config('fetch-credentials') || 'omit';
|
const credentials = config('fetch-credentials') || 'omit';
|
||||||
const perf = config('performance') === _true;
|
const perf = config('performance') === _true;
|
||||||
|
const autoPageview = config('auto-pageview') !== _false;
|
||||||
|
|
||||||
const domains = domain.split(',').map(n => n.trim());
|
const domains = domain.split(',').map(n => n.trim());
|
||||||
const host =
|
const host =
|
||||||
@@ -90,7 +91,7 @@
|
|||||||
currentRef = currentUrl;
|
currentRef = currentUrl;
|
||||||
currentUrl = normalize(new URL(url, location.href).toString());
|
currentUrl = normalize(new URL(url, location.href).toString());
|
||||||
|
|
||||||
if (currentUrl !== currentRef) {
|
if (currentUrl !== currentRef && autoPageview) {
|
||||||
setTimeout(track, delayDuration);
|
setTimeout(track, delayDuration);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -197,7 +198,7 @@
|
|||||||
const init = () => {
|
const init = () => {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
initialized = true;
|
initialized = true;
|
||||||
track();
|
if (autoPageview) track();
|
||||||
handlePathChanges();
|
handlePathChanges();
|
||||||
handleClicks();
|
handleClicks();
|
||||||
if (perf) initPerformance();
|
if (perf) initPerformance();
|
||||||
|
|||||||
Reference in New Issue
Block a user