simpleanalytics / roadmap

File you bugs and feature requests here
23 stars 2 forks source link

Collect page views via backend plus frontend #646

Open adriaandotcom opened 2 years ago

adriaandotcom commented 2 years ago

We already support frontend collecting of page views and events. How awesome would it be to support both backend and frontend tracking? Unfortunately, you will miss some data when you only use backend tracking. Time on page, better robot detection, scrolled percentage, ... is only doable via the frontend.

How about a way to do both? A backend is better at sending a request to Simple Analytics than a frontend. A frontend can fail to execute due to JavaScript errors, it can have ad-blockers, it can be blocked on a network level. But if you track both via frontend and backend it will cause double data.

What if we connect them both? Let's say you add a backend script that will send a unique ID to the frontend. The frontend can take care of getting the metrics only the frontend can collect. The backend will collect the traffic that is not tracked via the frontend. This way our customers can always collect everything they need.

Backend  > send a request to Simple Analytics
         > pass ID to frontend

Frontend > send a request to Simple Analytics
           (with ID from backend)

Simple Analytics combines both requests into one page view based on the generated ID of the backend.