Skip to content

[Suggestion] return the underlying fetch Promise in trackEvent/trackView #98

Closed
@valsinats42

Description

@valsinats42

Currently, the trackEvent and trackView functions fire off the collect fetch request, but there's no way for the client to track its progress. As a suggestion, the library could return the underlying fetch Promise, so it could be await-ed by the client code.

I'd find this useful, for example, if I want to track a click on an a tag with a href attribute. In the current situation, if I add a custom @click handler and call { umTrackEvent(..); window.location.href = ...}, I can't think of a clean way to guarantee that the event has been sent before the browser loads the new page and aborts the tracking request (of course, one can use a setTimeout, but that's not pretty).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions