Updated event handling.

This commit is contained in:
Mike Cao 2020-07-19 02:23:15 -07:00
parent 9f3acd1583
commit 9cb08956c0
7 changed files with 19 additions and 41 deletions

View file

@ -8,14 +8,14 @@ export default async (req, res) => {
const values = parseCollectRequest(req);
if (values.success) {
const { type, website_id, session_id, url, referrer, eventType, eventValue } = values;
const { type, website_id, session_id, url, referrer, event_type, event_value } = values;
if (type === 'pageview') {
await savePageView(website_id, session_id, url, referrer).catch(() => {
values.success = 0;
});
} else if (type === 'event') {
await saveEvent(website_id, session_id, url, eventType, eventValue).catch(() => {
await saveEvent(website_id, session_id, url, event_type, event_value).catch(() => {
values.success = 0;
});
}

View file

@ -15,7 +15,7 @@ export default function Home() {
<a>123</a>
</Link>
<br />
<button id="primary-button" className="otherClass umami--click" type="button">
<button id="primary-button" className="otherClass umami--click--primary-button" type="button">
Button
</button>
</Layout>