Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Send raw JSON.

Mike Caobb04015b4606
diff --git a/components/layout.js b/components/layout.js
index 9024686b0..c3880bd37 100644
--- a/components/layout.js
+++ b/components/layout.js
@@ -18,7 +18,7 @@ export default function Layout({ title, children }) {
async
defer
data-website-id="865234ad-6a92-11e7-8846-b05adad3f099"
- src="http://umami.is/umami.js"
+ src="/umami.js"
/>
)}
</Head>
diff --git a/lib/utils.js b/lib/utils.js
index 79879602e..18b94fa12 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -62,7 +62,7 @@ export async function getCountry(req, ip) {
export async function parseSessionRequest(req) {
const ip = getIpAddress(req);
- const { website_id, screen, language } = JSON.parse(req.body);
+ const { website_id, screen, language } = req.body;
const { userAgent, browser, os } = getDevice(req);
const country = await getCountry(req, ip);
const session_id = hash(`${website_id}${ip}${userAgent}${os}`);
@@ -79,7 +79,7 @@ export async function parseSessionRequest(req) {
}
export function parseCollectRequest(req) {
- const { type, payload } = JSON.parse(req.body);
+ const { type, payload } = req.body;
if (payload.session) {
const {
diff --git a/scripts/umami/index.js b/scripts/umami/index.js
index e48a969e4..f86896da0 100644
--- a/scripts/umami/index.js
+++ b/scripts/umami/index.js
@@ -18,7 +18,7 @@ function post(url, params) {
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify(params),
+ body: params,
}).then(res => res.json());
}