Refactor tracker.

This commit is contained in:
Mike Cao 2020-09-18 13:40:46 -07:00
parent 2e22deb58a
commit 023adafa39
8 changed files with 85 additions and 136 deletions

View file

@ -11,6 +11,12 @@ export default function Test() {
return <h1>No id query specified.</h1>;
}
function handleClick() {
window.umami('Custom event');
window.umami.pageView('/fake', 'https://www.google.com');
window.umami.pageEvent('pageEvent', 'custom-type');
}
return (
<>
<Head>
@ -20,7 +26,7 @@ export default function Test() {
</Head>
<Layout>
<p>
Here you can test if your umami installation works. Open the network tab in your browser's
Here you can test if your umami installation works. Open the network tab in your browser
developer console and watch for requests to the url <b>collect</b>. The links below should
trigger page views. Clicking on the button should trigger an event.
</p>
@ -40,6 +46,10 @@ export default function Test() {
>
Button
</button>
<h2>Manual trigger</h2>
<button id="manual-button" type="button" onClick={handleClick}>
Button
</button>
</Layout>
</>
);