From df018d73536ae04ffed817b9132ff795b60eeffa Mon Sep 17 00:00:00 2001 From: Ben Vinegar <2153+benvinegar@users.noreply.github.com> Date: Fri, 27 Dec 2024 22:10:17 -0500 Subject: [PATCH] Rollback newly introduced API methods (unnecessary) --- packages/reporter/src/index.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/reporter/src/index.ts b/packages/reporter/src/index.ts index 802ea2f4..496e8d19 100644 --- a/packages/reporter/src/index.ts +++ b/packages/reporter/src/index.ts @@ -44,17 +44,15 @@ const config: ConfigType = {}; const commands = { set: set, - reportPageview: reportPageview, - trackPageview: reportPageview, // backwards compat - setReporterUrl: setReporterUrl, - setTrackerUrl: setReporterUrl, // backwards compat + trackPageview: trackPageview, // backwards compat + setTrackerUrl: setTrackerUrl, // backwards compat }; function set(key: K, value: ConfigType[K]) { config[key] = value; } -function setReporterUrl(value: string) { +function setTrackerUrl(value: string) { return set("reporterUrl", value); } @@ -79,7 +77,7 @@ function findReporterScript() { return el; } -function reportPageview(vars: { [key: string]: string }) { +function trackPageview(vars: { [key: string]: string }) { vars = vars || {}; // ignore prerendered pages @@ -93,7 +91,7 @@ function reportPageview(vars: { [key: string]: string }) { // if did not load yet, try again at dom ready event if (document.body === null) { document.addEventListener("DOMContentLoaded", () => { - reportPageview(vars); + trackPageview(vars); }); return; } @@ -203,6 +201,6 @@ queue.forEach(function (cmd: Command) { const siteId = script.getAttribute("data-site-id"); if (siteId) { set("siteId", siteId); - reportPageview({}); + trackPageview({}); } })();