A 650b Google Analytics client for performance maniacs
This project is a non-official implementation of a Google Analytics JS client.
It does not uses cookies so is intendend only for projects that doesn't have strict requirements on user-tracking on Anlytics.
$ npm install analitiks
import { setup, trackPageView, trackEvent } from "https://cdn.skypack.dev/analitiks";
setup('UA-123456-1');
trackPageView();
document.getElementById('mybutton').addEventListener('click', () => {
trackEvent('category', 'action', 'label', 1);
});
This client supports also an anonymous mode where:
- The flag "anonymize ip" is on
- the user id is randomized at each request
- No credentials are sent
Example:
import { setup, trackPageView, trackEvent } from "https://cdn.skypack.dev/analitiks";
setup('UA-123456-1', true /* enables anonymous mode */);
trackPageView();
document.getElementById('mybutton').addEventListener('click', () => {
trackEvent('category', 'action', 'label', 1);
});