Closed emschwartz closed 3 years ago
@electerious any thoughts on this?
Sounds like a good idea, but it might require some refactoring as the instance can't return the id
immediately (only async). Ackee v2 will ship with a new ackee-tracker. I will change the return value of the instance to an object instead of the stop-function before releasing the next version. This makes it easier to implement such features in the future without making it a breaking change.
What do you think about this approach? https://github.com/electerious/ackee-tracker/pull/19 I tried to modify the structure as little as possible. If you like the approach I can clean up the PR and add the methods to the docs.
Actually another way to go would be to have an option that would store the recordId
in sessionStorage
and use that if it's saved there. Any preference?
Thanks for the PR! Will take a closer look at it when I work on events as the id feature itself doesn't have a big priority for now. I recommend to use your fork in the meantime.
The events (https://github.com/electerious/Ackee/issues/40#issuecomment-678634751) also need an update function and a way to get the id which I will probably do in the same way.
Implemented the updateRecord function on the events branch (not tested, yet).
This feature has been implemented in v5 (will ship along with Ackee v3). I've added a callback to the record function so it's possible to obtain the recordId and a new function called .updateRecord
to start updating an existing record. Hope that helps :)
https://github.com/electerious/ackee-tracker/tree/feature/v5#updaterecordrecordid
I have a use case where I expect that users may reload the webpage but I would like to treat all of their time spent across multiple tab reloads as part of the same visit.
Would it be possible to expose an ID on the instance that could be saved to localStorage and set on a new instance if the page is reloaded?