Support `type=append` on the HTTP endpoint so that we can track duration like the browser

I want to be able to track how long a user spends on a screen in my mobile app.

I checked how the javascript script works on the browser and i noticed 2 request are sent. 1st event is a ‘pageview’ type, which is sent as soon as the user visits the page. The 2nd event is of type ‘append’, which adds the duration of the time spent on the page, by providing an id, that is also provided on the 1st event.

I tried doing the same via the HTTP API but it seems like it doesn’t support ‘append’. I think it falls back to type ‘event’ because it complains I did not pass a value for ‘event’.

I understand that I ‘might’ be able to track the duration if i provide it via the ‘pageview’ (can’t test this because of this bug). However I prefer the 2 http request approach because the user might see the screen and then the mobile app might stop without a callback (so no events will be sent).

What would you like to have?

I want to track time spent on a page via the HTTP API like the browser.

What is your use-case?

Keep track of time spent in my mobile app/pages.

How does it help other customers?

Nice stats about time spent on mobile apps using SA.

Or we should allow type = event, event = pageview, duration = "6" or 6.

Are you suggesting to provide the duration on the page view? It will work yes. However the appending approach is much better for mobile apps, as there is a change the client won’t listen to the screen/page going away, so data can be lost.