Analytics examples, using Amplitude vendor
Amplitude is great for getting started but if you need more than what the free plan offers, then you better make sure you can afford it.
It's much more comfortable from a developer standpoint that everything we've worked with by the past.
We only use Amplitude from the client, mostly because Amplitude didn't provide a nodejs compatible library until very recently.
Also, we prefer to perform all reporting on the client side, as it avoids issues with multiple events sent by mistake.
The app is configured in a way that all usual web-related analytics options are handled out the box.
It also comes with a shared configuration for all pages (see below) and user-session tracking.
Regarding GDPR concerns, the IP address is not processed/stored by any vendor (analytics data are anonymous). Several cookies are created on the device if the user hasn't opted out of tracking (through the Cookie Consent popup).
Shared analytics configuration
The below code is the shared configuration between all pages.
It initializes the whole thing, and automatically track app-wide data so that all event will contain those properties automatically.
Events - Automated page views
Below is how we automatically track all page views (through the
Events - User interactions
Below is how we log events upon user interaction. (i.e: click)
When you click on the below button an event
analytics-button-test-event is sent to Amplitude.
No data will be sent if you've opted-out of analytics tracking:
You can check the event details using Amplitude Instrumentation Explorer Chrome extension.